From 494fa31475cea5724e5b5cbbbe287b963f969c49 Mon Sep 17 00:00:00 2001 From: caremoli Date: Fri, 9 Nov 2007 18:03:20 +0000 Subject: [PATCH] CCAR: merge from branch BR_Dev_For_4_0 tag V4_1_0rc1 --- bin/launchConfigureParser.py | 2 - bin/runSalome.py | 4 + bin/setenv.py | 16 +- configure.ac | 14 +- idl/DSC_Engines.idl | 9 + idl/SALOMEDS.idl | 10 + idl/SALOME_ContainerManager.idl | 5 + idl/SALOME_ModuleCatalog.idl | 10 + idl/SALOME_Registry.idl | 1 + idl/SALOME_Session.idl | 4 + resources/Makefile.am | 3 +- src/CASCatch/CASCatch.hxx | 55 -- src/CASCatch/CASCatch_CatchSignals.cxx | 333 ------- src/CASCatch/CASCatch_CatchSignals.hxx | 63 -- src/CASCatch/CASCatch_ErrorHandler.cxx | 122 --- src/CASCatch/CASCatch_ErrorHandler.hxx | 92 -- src/CASCatch/CASCatch_Failure.cxx | 126 --- src/CASCatch/CASCatch_Failure.hxx | 60 -- src/CASCatch/Makefile.am | 41 - src/Container/SALOME_ContainerManager.cxx | 25 + src/Container/SALOME_ContainerManager.hxx | 3 + src/DF/DF_Application.cxx | 79 ++ src/DF/DF_Application.hxx | 47 + src/DF/DF_Attribute.cxx | 42 + src/DF/DF_Attribute.hxx | 60 ++ src/DF/DF_ChildIterator.cxx | 80 ++ src/DF/DF_ChildIterator.hxx | 38 + src/DF/DF_Container.cxx | 196 ++++ src/DF/DF_Container.hxx | 85 ++ src/DF/DF_Document.cxx | 125 +++ src/DF/DF_Document.hxx | 65 ++ src/DF/DF_Label.cxx | 473 ++++++++++ src/DF/DF_Label.hxx | 155 ++++ src/DF/DF_definitions.hxx | 125 +++ src/DF/Makefile.am | 99 ++ src/DF/testDF.cxx | 311 +++++++ src/DSC/DSC_Basic/ConnectionManager_i.cxx | 12 + src/DSC/DSC_Basic/ConnectionManager_i.hxx | 10 + src/HDFPersist/HDFascii.cc | 241 ++--- src/Launcher/Makefile.am | 1 - src/Makefile.am | 2 +- .../SALOME_ModuleCatalog_impl.cxx | 40 +- .../SALOME_ModuleCatalog_impl.hxx | 2 + src/Registry/RegistryService.cxx | 5 + src/Registry/RegistryService.hxx | 1 + src/Registry/SALOME_Registry_Server.cxx | 8 +- ...DS_DataMapNodeOfDataMapOfIntegerString.hxx | 80 -- ...LOMEDS_DataMapNodeOfDataMapStringLabel.hxx | 102 --- .../Handle_SALOMEDS_DrawableAttribute.hxx | 102 --- .../Handle_SALOMEDS_ExpandableAttribute.hxx | 102 --- .../Handle_SALOMEDS_ExternalFileDef.hxx | 86 -- src/SALOMEDS/Handle_SALOMEDS_FileType.hxx | 87 -- src/SALOMEDS/Handle_SALOMEDS_IORAttribute.hxx | 102 --- .../Handle_SALOMEDS_LocalIDAttribute.hxx | 102 --- .../Handle_SALOMEDS_OCAFApplication.hxx | 102 --- .../Handle_SALOMEDS_OpenedAttribute.hxx | 102 --- .../Handle_SALOMEDS_PersRefAttribute.hxx | 102 --- .../Handle_SALOMEDS_PixMapAttribute.hxx | 102 --- .../Handle_SALOMEDS_PythonObjectAttribute.hxx | 85 -- .../Handle_SALOMEDS_SelectableAttribute.hxx | 102 --- ...le_SALOMEDS_SequenceOfIntegerAttribute.hxx | 98 -- ...andle_SALOMEDS_SequenceOfRealAttribute.hxx | 98 -- ...ndle_SALOMEDS_StudyPropertiesAttribute.hxx | 85 -- ...andle_SALOMEDS_TableOfIntegerAttribute.hxx | 85 -- .../Handle_SALOMEDS_TableOfRealAttribute.hxx | 85 -- ...Handle_SALOMEDS_TableOfStringAttribute.hxx | 84 -- .../Handle_SALOMEDS_TargetAttribute.hxx | 102 --- .../Handle_SALOMEDS_TextColorAttribute.hxx | 102 --- ...e_SALOMEDS_TextHighlightColorAttribute.hxx | 102 --- src/SALOMEDS/Makefile.am | 58 +- src/SALOMEDS/SALOMEDS.cdl | 59 -- src/SALOMEDS/SALOMEDS_AttLong_i.cxx | 11 +- src/SALOMEDS/SALOMEDS_AttLong_i.hxx | 1 - src/SALOMEDS/SALOMEDS_AttReal_i.cxx | 11 +- src/SALOMEDS/SALOMEDS_AttReal_i.hxx | 1 - src/SALOMEDS/SALOMEDS_AttributeComment.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeComment.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx | 8 +- src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx | 10 +- src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx | 2 +- .../SALOMEDS_AttributeExpandable_i.cxx | 4 +- .../SALOMEDS_AttributeExpandable_i.hxx | 2 +- .../SALOMEDS_AttributeExternalFileDef.cxx | 10 +- .../SALOMEDS_AttributeExternalFileDef.hxx | 2 +- .../SALOMEDS_AttributeExternalFileDef_i.cxx | 5 +- .../SALOMEDS_AttributeExternalFileDef_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeFileType.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeFileType.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx | 6 +- src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeFlags.cxx | 11 +- src/SALOMEDS/SALOMEDS_AttributeFlags.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx | 8 +- src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx | 6 +- src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeIOR.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeIOR.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx | 7 +- src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeInteger.cxx | 15 +- src/SALOMEDS/SALOMEDS_AttributeInteger.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx | 8 +- src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeName.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeName.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeName_i.cxx | 5 +- src/SALOMEDS/SALOMEDS_AttributeName_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeOpened.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeOpened.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx | 6 +- src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeParameter.cxx | 49 +- src/SALOMEDS/SALOMEDS_AttributeParameter.hxx | 2 +- .../SALOMEDS_AttributeParameter_i.cxx | 43 +- .../SALOMEDS_AttributeParameter_i.hxx | 2 +- .../SALOMEDS_AttributePersistentRef.cxx | 9 +- .../SALOMEDS_AttributePersistentRef.hxx | 2 +- .../SALOMEDS_AttributePersistentRef_i.cxx | 5 +- .../SALOMEDS_AttributePersistentRef_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributePixMap.cxx | 11 +- src/SALOMEDS/SALOMEDS_AttributePixMap.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx | 2 +- .../SALOMEDS_AttributePythonObject.cxx | 12 +- .../SALOMEDS_AttributePythonObject.hxx | 2 +- .../SALOMEDS_AttributePythonObject_i.cxx | 11 +- .../SALOMEDS_AttributePythonObject_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeReal.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeReal.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx | 2 +- .../SALOMEDS_AttributeSelectable_i.cxx | 6 +- .../SALOMEDS_AttributeSelectable_i.hxx | 2 +- .../SALOMEDS_AttributeSequenceOfInteger.cxx | 24 +- .../SALOMEDS_AttributeSequenceOfInteger.hxx | 2 +- .../SALOMEDS_AttributeSequenceOfInteger_i.cxx | 31 +- .../SALOMEDS_AttributeSequenceOfInteger_i.hxx | 2 +- .../SALOMEDS_AttributeSequenceOfReal.cxx | 24 +- .../SALOMEDS_AttributeSequenceOfReal.hxx | 2 +- .../SALOMEDS_AttributeSequenceOfReal_i.cxx | 27 +- .../SALOMEDS_AttributeSequenceOfReal_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeString.cxx | 9 +- src/SALOMEDS/SALOMEDS_AttributeString.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeString_i.cxx | 6 +- src/SALOMEDS/SALOMEDS_AttributeString_i.hxx | 2 +- .../SALOMEDS_AttributeStudyProperties.cxx | 70 +- .../SALOMEDS_AttributeStudyProperties.hxx | 8 +- .../SALOMEDS_AttributeStudyProperties_i.cxx | 72 +- .../SALOMEDS_AttributeStudyProperties_i.hxx | 2 +- .../SALOMEDS_AttributeTableOfInteger.cxx | 110 +-- .../SALOMEDS_AttributeTableOfInteger.hxx | 2 +- .../SALOMEDS_AttributeTableOfInteger_i.cxx | 135 ++- .../SALOMEDS_AttributeTableOfInteger_i.hxx | 2 +- .../SALOMEDS_AttributeTableOfReal.cxx | 108 +-- .../SALOMEDS_AttributeTableOfReal.hxx | 2 +- .../SALOMEDS_AttributeTableOfReal_i.cxx | 128 ++- .../SALOMEDS_AttributeTableOfReal_i.hxx | 2 +- .../SALOMEDS_AttributeTableOfString.cxx | 109 +-- .../SALOMEDS_AttributeTableOfString.hxx | 2 +- .../SALOMEDS_AttributeTableOfString_i.cxx | 147 ++- .../SALOMEDS_AttributeTableOfString_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTarget.cxx | 18 +- src/SALOMEDS/SALOMEDS_AttributeTarget.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx | 23 +- src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx | 26 +- src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx | 2 +- .../SALOMEDS_AttributeTextColor_i.cxx | 22 +- .../SALOMEDS_AttributeTextColor_i.hxx | 2 +- .../SALOMEDS_AttributeTextHighlightColor.cxx | 25 +- .../SALOMEDS_AttributeTextHighlightColor.hxx | 2 +- ...SALOMEDS_AttributeTextHighlightColor_i.cxx | 22 +- ...SALOMEDS_AttributeTextHighlightColor_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx | 130 ++- src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx | 74 +- src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeUserID.cxx | 14 +- src/SALOMEDS/SALOMEDS_AttributeUserID.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx | 7 +- src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx | 4 +- src/SALOMEDS/SALOMEDS_Attributes.hxx | 2 +- src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx | 2 +- src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx | 6 +- src/SALOMEDS/SALOMEDS_ChildIterator.cxx | 8 +- src/SALOMEDS/SALOMEDS_ChildIterator.hxx | 4 +- src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx | 7 +- src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx | 4 +- src/SALOMEDS/SALOMEDS_Client.cxx | 18 +- src/SALOMEDS/SALOMEDS_ClientAttributes.hxx | 2 +- ...ataMapIteratorOfDataMapOfIntegerString.hxx | 95 -- ...aMapIteratorOfDataMapOfIntegerString_0.cxx | 46 - ...DS_DataMapIteratorOfDataMapStringLabel.hxx | 114 --- ..._DataMapIteratorOfDataMapStringLabel_0.cxx | 64 -- ...DS_DataMapNodeOfDataMapOfIntegerString.hxx | 132 --- ..._DataMapNodeOfDataMapOfIntegerString_0.cxx | 95 -- ...LOMEDS_DataMapNodeOfDataMapStringLabel.hxx | 154 ---- ...MEDS_DataMapNodeOfDataMapStringLabel_0.cxx | 113 --- .../SALOMEDS_DataMapOfIntegerString.hxx | 127 --- .../SALOMEDS_DataMapOfIntegerString_0.cxx | 49 - src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx | 146 --- .../SALOMEDS_DataMapStringLabel_0.cxx | 67 -- src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl | 73 -- src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx | 114 --- src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx | 127 --- src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_Driver_i.cxx | 111 ++- src/SALOMEDS/SALOMEDS_Driver_i.hxx | 81 +- src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl | 73 -- src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx | 114 --- src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx | 127 --- src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl | 73 -- src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx | 114 --- src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx | 110 --- src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx | 75 -- src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx | 37 - src/SALOMEDS/SALOMEDS_FileType.cdl | 73 -- src/SALOMEDS/SALOMEDS_FileType.cxx | 114 --- src/SALOMEDS/SALOMEDS_FileType.hxx | 110 --- src/SALOMEDS/SALOMEDS_FileType.ixx | 74 -- src/SALOMEDS/SALOMEDS_FileType.jxx | 37 - src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx | 162 ---- src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx | 72 -- src/SALOMEDS/SALOMEDS_GenericAttribute.cxx | 22 +- src/SALOMEDS/SALOMEDS_GenericAttribute.hxx | 6 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx | 41 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx | 12 +- src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx | 185 ---- src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx | 80 -- src/SALOMEDS/SALOMEDS_IORAttribute.cdl | 73 -- src/SALOMEDS/SALOMEDS_IORAttribute.cxx | 117 --- src/SALOMEDS/SALOMEDS_IORAttribute.hxx | 131 --- src/SALOMEDS/SALOMEDS_IORAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_IORAttribute.jxx | 44 - src/SALOMEDS/SALOMEDS_IParameters.cxx | 18 +- src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl | 72 -- src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx | 114 --- src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx | 127 --- src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_OCAFApplication.cdl | 45 - src/SALOMEDS/SALOMEDS_OCAFApplication.cxx | 66 -- src/SALOMEDS/SALOMEDS_OCAFApplication.hxx | 114 --- src/SALOMEDS/SALOMEDS_OCAFApplication.ixx | 87 -- src/SALOMEDS/SALOMEDS_OCAFApplication.jxx | 32 - src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl | 74 -- src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx | 114 --- src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx | 127 --- src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl | 73 -- src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx | 113 --- src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx | 125 --- src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx | 44 - src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl | 73 -- src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx | 113 --- src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx | 125 --- src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx | 46 - .../SALOMEDS_PythonObjectAttribute.cdl | 83 -- .../SALOMEDS_PythonObjectAttribute.cxx | 89 -- .../SALOMEDS_PythonObjectAttribute.hxx | 126 --- .../SALOMEDS_PythonObjectAttribute.ixx | 68 -- .../SALOMEDS_PythonObjectAttribute.jxx | 29 - src/SALOMEDS/SALOMEDS_SAttribute_i.hxx | 63 -- src/SALOMEDS/SALOMEDS_SComponent.cxx | 11 +- src/SALOMEDS/SALOMEDS_SComponent.hxx | 2 +- src/SALOMEDS/SALOMEDS_SComponentIterator.cxx | 11 +- src/SALOMEDS/SALOMEDS_SComponentIterator.hxx | 2 +- .../SALOMEDS_SComponentIterator_i.cxx | 11 +- .../SALOMEDS_SComponentIterator_i.hxx | 4 +- src/SALOMEDS/SALOMEDS_SComponent_i.cxx | 29 +- src/SALOMEDS/SALOMEDS_SComponent_i.hxx | 4 +- src/SALOMEDS/SALOMEDS_SObject.cxx | 56 +- src/SALOMEDS/SALOMEDS_SObject.hxx | 8 +- src/SALOMEDS/SALOMEDS_SObject_i.cxx | 69 +- src/SALOMEDS/SALOMEDS_SObject_i.hxx | 8 +- src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl | 74 -- src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx | 114 --- src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx | 127 --- src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx | 43 - .../SALOMEDS_SequenceOfIntegerAttribute.cdl | 101 -- .../SALOMEDS_SequenceOfIntegerAttribute.cxx | 151 --- .../SALOMEDS_SequenceOfIntegerAttribute.hxx | 134 --- .../SALOMEDS_SequenceOfIntegerAttribute.ixx | 85 -- .../SALOMEDS_SequenceOfIntegerAttribute.jxx | 46 - .../SALOMEDS_SequenceOfRealAttribute.cdl | 100 -- .../SALOMEDS_SequenceOfRealAttribute.cxx | 153 ---- .../SALOMEDS_SequenceOfRealAttribute.hxx | 137 --- .../SALOMEDS_SequenceOfRealAttribute.ixx | 85 -- .../SALOMEDS_SequenceOfRealAttribute.jxx | 46 - src/SALOMEDS/SALOMEDS_Server.cxx | 6 +- src/SALOMEDS/SALOMEDS_Study.cxx | 129 ++- src/SALOMEDS/SALOMEDS_Study.hxx | 4 +- src/SALOMEDS/SALOMEDS_StudyBuilder.cxx | 72 +- src/SALOMEDS/SALOMEDS_StudyBuilder.hxx | 4 +- src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx | 97 +- src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx | 9 +- src/SALOMEDS/SALOMEDS_StudyManager.cxx | 42 +- src/SALOMEDS/SALOMEDS_StudyManager.hxx | 2 +- src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 111 ++- src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 13 +- .../SALOMEDS_StudyPropertiesAttribute.cdl | 107 --- .../SALOMEDS_StudyPropertiesAttribute.cxx | 217 ----- .../SALOMEDS_StudyPropertiesAttribute.hxx | 148 --- .../SALOMEDS_StudyPropertiesAttribute.ixx | 68 -- .../SALOMEDS_StudyPropertiesAttribute.jxx | 35 - src/SALOMEDS/SALOMEDS_Study_i.cxx | 216 ++--- src/SALOMEDS/SALOMEDS_Study_i.hxx | 15 +- src/SALOMEDS/SALOMEDS_TMPFile_i.cxx | 10 - src/SALOMEDS/SALOMEDS_TMPFile_i.hxx | 6 - .../SALOMEDS_TableOfIntegerAttribute.cxx | 399 -------- .../SALOMEDS_TableOfIntegerAttribute.hxx | 163 ---- .../SALOMEDS_TableOfIntegerAttribute.ixx | 68 -- .../SALOMEDS_TableOfIntegerAttribute.jxx | 35 - .../SALOMEDS_TableOfRealAttribute.cxx | 405 -------- .../SALOMEDS_TableOfRealAttribute.hxx | 171 ---- .../SALOMEDS_TableOfRealAttribute.ixx | 68 -- .../SALOMEDS_TableOfRealAttribute.jxx | 35 - .../SALOMEDS_TableOfStringAttribute.cxx | 423 --------- .../SALOMEDS_TableOfStringAttribute.hxx | 170 ---- .../SALOMEDS_TableOfStringAttribute.ixx | 67 -- .../SALOMEDS_TableOfStringAttribute.jxx | 34 - src/SALOMEDS/SALOMEDS_TargetAttribute.cdl | 70 -- src/SALOMEDS/SALOMEDS_TargetAttribute.cxx | 122 --- src/SALOMEDS/SALOMEDS_TargetAttribute.hxx | 133 --- src/SALOMEDS/SALOMEDS_TargetAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_TargetAttribute.jxx | 43 - src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl | 69 -- src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx | 93 -- src/SALOMEDS/SALOMEDS_TextColorAttribute.hxx | 122 --- src/SALOMEDS/SALOMEDS_TextColorAttribute.ixx | 87 -- src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx | 40 - .../SALOMEDS_TextHighlightColorAttribute.cdl | 68 -- .../SALOMEDS_TextHighlightColorAttribute.cxx | 92 -- .../SALOMEDS_TextHighlightColorAttribute.hxx | 122 --- .../SALOMEDS_TextHighlightColorAttribute.ixx | 87 -- .../SALOMEDS_TextHighlightColorAttribute.jxx | 40 - src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx | 29 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx | 6 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx | 36 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx | 8 +- src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx | 18 +- src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx | 6 +- src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx | 13 +- src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx | 4 +- src/SALOMEDS/SALOME_DriverPy.py | 4 +- src/SALOMEDS/Test/Makefile.am | 7 +- src/SALOMEDS/Test/SALOMEDSTest.cxx | 11 +- src/SALOMEDS/Test/SALOMEDSTest.hxx | 24 +- .../Test/SALOMEDSTest_AttributeExpandable.cxx | 10 +- .../Test/SALOMEDSTest_AttributeSelectable.cxx | 10 +- ...ALOMEDSTest_AttributeSequenceOfInteger.cxx | 1 + .../SALOMEDSTest_AttributeTableOfInteger.cxx | 15 +- .../SALOMEDSTest_AttributeTableOfReal.cxx | 1 - .../Test/SALOMEDSTest_AttributeTextColor.cxx | 2 +- .../Test/SALOMEDSTest_AttributeTreeNode.cxx | 19 +- .../Test/SALOMEDSTest_AttributeUserID.cxx | 13 +- .../Test/SALOMEDSTest_ChildIterator.cxx | 2 +- src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx | 1 + src/SALOMEDS/Test/SALOMEDSTest_Study.cxx | 2 +- .../Test/SALOMEDSTest_StudyBuilder.cxx | 65 +- .../Test/SALOMEDSTest_StudyManager.cxx | 10 +- src/SALOMEDS/Test/TestSALOMEDS.cxx | 4 - src/SALOMEDS/Test/TestSALOMEDS.py | 5 +- src/SALOMEDSImpl/Makefile.am | 10 +- .../SALOMEDSImpl_AttributeComment.cxx | 30 +- .../SALOMEDSImpl_AttributeComment.hxx | 37 +- .../SALOMEDSImpl_AttributeDrawable.cxx | 30 +- .../SALOMEDSImpl_AttributeDrawable.hxx | 40 +- .../SALOMEDSImpl_AttributeExpandable.cxx | 30 +- .../SALOMEDSImpl_AttributeExpandable.hxx | 36 +- .../SALOMEDSImpl_AttributeExternalFileDef.cxx | 30 +- .../SALOMEDSImpl_AttributeExternalFileDef.hxx | 40 +- .../SALOMEDSImpl_AttributeFileType.cxx | 30 +- .../SALOMEDSImpl_AttributeFileType.hxx | 40 +- .../SALOMEDSImpl_AttributeFlags.cxx | 33 +- .../SALOMEDSImpl_AttributeFlags.hxx | 35 +- .../SALOMEDSImpl_AttributeGraphic.cxx | 83 +- .../SALOMEDSImpl_AttributeGraphic.hxx | 39 +- .../SALOMEDSImpl_AttributeIOR.cxx | 41 +- .../SALOMEDSImpl_AttributeIOR.hxx | 36 +- .../SALOMEDSImpl_AttributeInteger.cxx | 58 +- .../SALOMEDSImpl_AttributeInteger.hxx | 42 +- .../SALOMEDSImpl_AttributeLocalID.cxx | 50 +- .../SALOMEDSImpl_AttributeLocalID.hxx | 40 +- .../SALOMEDSImpl_AttributeName.cxx | 30 +- .../SALOMEDSImpl_AttributeName.hxx | 40 +- .../SALOMEDSImpl_AttributeOpened.cxx | 31 +- .../SALOMEDSImpl_AttributeOpened.hxx | 36 +- .../SALOMEDSImpl_AttributeParameter.cxx | 58 +- .../SALOMEDSImpl_AttributeParameter.hxx | 48 +- .../SALOMEDSImpl_AttributePersistentRef.cxx | 31 +- .../SALOMEDSImpl_AttributePersistentRef.hxx | 40 +- .../SALOMEDSImpl_AttributePixMap.cxx | 32 +- .../SALOMEDSImpl_AttributePixMap.hxx | 45 +- .../SALOMEDSImpl_AttributePythonObject.cxx | 51 +- .../SALOMEDSImpl_AttributePythonObject.hxx | 40 +- .../SALOMEDSImpl_AttributeReal.cxx | 49 +- .../SALOMEDSImpl_AttributeReal.hxx | 42 +- .../SALOMEDSImpl_AttributeReference.cxx | 50 +- .../SALOMEDSImpl_AttributeReference.hxx | 41 +- .../SALOMEDSImpl_AttributeSelectable.cxx | 31 +- .../SALOMEDSImpl_AttributeSelectable.hxx | 41 +- ...ALOMEDSImpl_AttributeSequenceOfInteger.cxx | 104 +-- ...ALOMEDSImpl_AttributeSequenceOfInteger.hxx | 52 +- .../SALOMEDSImpl_AttributeSequenceOfReal.cxx | 106 +-- .../SALOMEDSImpl_AttributeSequenceOfReal.hxx | 49 +- .../SALOMEDSImpl_AttributeString.cxx | 30 +- .../SALOMEDSImpl_AttributeString.hxx | 38 +- .../SALOMEDSImpl_AttributeStudyProperties.cxx | 226 +++-- .../SALOMEDSImpl_AttributeStudyProperties.hxx | 127 ++- .../SALOMEDSImpl_AttributeTableOfInteger.cxx | 405 ++++---- .../SALOMEDSImpl_AttributeTableOfInteger.hxx | 106 +-- .../SALOMEDSImpl_AttributeTableOfReal.cxx | 414 ++++----- .../SALOMEDSImpl_AttributeTableOfReal.hxx | 115 +-- .../SALOMEDSImpl_AttributeTableOfString.cxx | 420 ++++----- .../SALOMEDSImpl_AttributeTableOfString.hxx | 115 +-- .../SALOMEDSImpl_AttributeTarget.cxx | 95 +- .../SALOMEDSImpl_AttributeTarget.hxx | 49 +- .../SALOMEDSImpl_AttributeTextColor.cxx | 65 +- .../SALOMEDSImpl_AttributeTextColor.hxx | 40 +- ...LOMEDSImpl_AttributeTextHighlightColor.cxx | 68 +- ...LOMEDSImpl_AttributeTextHighlightColor.hxx | 40 +- .../SALOMEDSImpl_AttributeTreeNode.cxx | 313 +++---- .../SALOMEDSImpl_AttributeTreeNode.hxx | 122 ++- .../SALOMEDSImpl_AttributeUserID.cxx | 34 +- .../SALOMEDSImpl_AttributeUserID.hxx | 38 +- src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx | 14 +- src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx | 2 - src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx | 21 +- .../SALOMEDSImpl_ChildIterator.cxx | 38 +- .../SALOMEDSImpl_ChildIterator.hxx | 30 +- .../SALOMEDSImpl_ChildNodeIterator.cxx | 12 +- .../SALOMEDSImpl_ChildNodeIterator.hxx | 31 +- src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx | 66 +- .../SALOMEDSImpl_GenericAttribute.cxx | 40 +- .../SALOMEDSImpl_GenericAttribute.hxx | 37 +- src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx | 86 +- src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx | 14 +- .../SALOMEDSImpl_OCAFApplication.cxx | 65 -- .../SALOMEDSImpl_OCAFApplication.hxx | 51 -- src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx | 61 +- src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx | 29 +- .../SALOMEDSImpl_SComponentIterator.cxx | 29 +- .../SALOMEDSImpl_SComponentIterator.hxx | 16 +- src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx | 169 ++-- src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx | 82 +- src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 867 ++++++++---------- src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx | 189 ++-- .../SALOMEDSImpl_StudyBuilder.cxx | 603 ++++++------ .../SALOMEDSImpl_StudyBuilder.hxx | 88 +- src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx | 39 +- src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx | 38 +- .../SALOMEDSImpl_StudyManager.cxx | 623 ++++++------- .../SALOMEDSImpl_StudyManager.hxx | 121 ++- src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx | 7 - src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx | 13 +- src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx | 247 +++-- src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx | 25 +- .../SALOMEDSImpl_UseCaseBuilder.cxx | 233 +++-- .../SALOMEDSImpl_UseCaseBuilder.hxx | 50 +- .../SALOMEDSImpl_UseCaseIterator.cxx | 39 +- .../SALOMEDSImpl_UseCaseIterator.hxx | 29 +- src/SALOMEDSImpl/Test/Makefile.am | 3 +- src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx | 15 +- src/SALOMEDSImpl/testDS.cxx | 126 ++- src/TOOLSDS/Makefile.am | 4 +- src/TOOLSDS/SALOMEDS_Tool.cxx | 221 +++-- src/Utils/Utils_ORB_INIT.cxx | 15 +- 489 files changed, 7900 insertions(+), 22221 deletions(-) delete mode 100644 src/CASCatch/CASCatch.hxx delete mode 100644 src/CASCatch/CASCatch_CatchSignals.cxx delete mode 100644 src/CASCatch/CASCatch_CatchSignals.hxx delete mode 100644 src/CASCatch/CASCatch_ErrorHandler.cxx delete mode 100644 src/CASCatch/CASCatch_ErrorHandler.hxx delete mode 100644 src/CASCatch/CASCatch_Failure.cxx delete mode 100644 src/CASCatch/CASCatch_Failure.hxx delete mode 100644 src/CASCatch/Makefile.am create mode 100644 src/DF/DF_Application.cxx create mode 100644 src/DF/DF_Application.hxx create mode 100644 src/DF/DF_Attribute.cxx create mode 100644 src/DF/DF_Attribute.hxx create mode 100644 src/DF/DF_ChildIterator.cxx create mode 100644 src/DF/DF_ChildIterator.hxx create mode 100644 src/DF/DF_Container.cxx create mode 100644 src/DF/DF_Container.hxx create mode 100644 src/DF/DF_Document.cxx create mode 100644 src/DF/DF_Document.hxx create mode 100644 src/DF/DF_Label.cxx create mode 100644 src/DF/DF_Label.hxx create mode 100644 src/DF/DF_definitions.hxx create mode 100644 src/DF/Makefile.am create mode 100644 src/DF/testDF.cxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_DrawableAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_ExpandableAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_FileType.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_IORAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_LocalIDAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_OCAFApplication.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_OpenedAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_PersRefAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_PixMapAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_PythonObjectAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_SelectableAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_SequenceOfRealAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_StudyPropertiesAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TableOfIntegerAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TableOfRealAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TableOfStringAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TargetAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TextColorAttribute.hxx delete mode 100644 src/SALOMEDS/Handle_SALOMEDS_TextHighlightColorAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_FileType.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_IORAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_OCAFApplication.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_SAttribute_i.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfRealAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfRealAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfRealAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfRealAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfStringAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfStringAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfStringAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TableOfStringAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TargetAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_TargetAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TargetAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TargetAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TargetAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextColorAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextColorAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cdl delete mode 100644 src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.hxx delete mode 100644 src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.ixx delete mode 100644 src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx delete mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.cxx delete mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 51d16de15..150f15598 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -786,12 +786,10 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): args["session_gui"] = False args[batch_nam] = False args["study_hdf"] = None - print 'launchConfigureParser cmd_opts',cmd_opts if cmd_opts.gui is not None: args[gui_nam] = cmd_opts.gui if cmd_opts.batch is not None: args[batch_nam] = True - print 'launchConfigureParser args[',batch_nam,']',args[batch_nam] if args[gui_nam]: args["session_gui"] = True if cmd_opts.desktop is not None: diff --git a/bin/runSalome.py b/bin/runSalome.py index b3f37dc9a..6c01d90e4 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -765,8 +765,12 @@ def searchFreePort(args, save_config=1): f = open(os.environ['OMNIORB_CONFIG'], "w") import CORBA if CORBA.ORB_ID == "omniORB4": + initref += "\ngiopMaxMsgSize = 2097152000 # 2 GBytes"; + initref += "\ntraceLevel = 0 # critical errors only"; f.write("InitRef = %s\n"%(initref)) else: + initref += "\nORBgiopMaxMsgSize = 2097152000 # 2 GBytes"; + initref += "\nORBtraceLevel = 0 # critical errors only"; f.write("ORBInitRef %s\n"%(initref)) pass f.close() diff --git a/bin/setenv.py b/bin/setenv.py index a01918144..5ee55b7d9 100755 --- a/bin/setenv.py +++ b/bin/setenv.py @@ -264,18 +264,20 @@ def set_env(args, modules_list, modules_root_dir): #if os.getenv("GUI_ROOT_DIR"): #if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui" - # 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","kernel") os.environ["CSF_SALOMEDS_ResourcesDefaults"] \ = os.path.join(modules_root_dir["KERNEL"],"share", salome_subdir,"resources","kernel") if "GEOM" in modules_list: - if verbose(): print "GEOM OCAF Resources" + if verbose(): print "GEOM OCAF Resources" + + # 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["GEOM"],"share", + salome_subdir,"resources","geom") os.environ["CSF_GEOMDS_ResourcesDefaults"] \ = os.path.join(modules_root_dir["GEOM"],"share", salome_subdir,"resources","geom") diff --git a/configure.ac b/configure.ac index af68c9a39..c6fb0228d 100644 --- a/configure.ac +++ b/configure.ac @@ -186,14 +186,6 @@ echo CHECK_HDF5 -echo -echo --------------------------------------------- -echo Testing OpenCascade -echo --------------------------------------------- -echo - -CHECK_CAS - # ---------------------------------------------------------------------------- # --- test corba @@ -424,9 +416,9 @@ function check_fatal_error { # -------------------------------------- if test x$corba_gen = xtrue; then - basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok occ_ok" + basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok" else - basic_mandatory_products="cc_ok threads_ok hdf5_ok occ_ok" + basic_mandatory_products="cc_ok threads_ok hdf5_ok" fi echo --- General mandatory products - Light configuration: @@ -553,11 +545,11 @@ AC_OUTPUT([ \ ./src/Basics/Test/Makefile \ ./src/Batch/Makefile \ ./src/Batch_SWIG/Makefile \ - ./src/CASCatch/Makefile \ ./src/Communication/Makefile \ ./src/Communication_SWIG/Makefile \ ./src/Container/Makefile \ ./src/ParallelContainer/Makefile \ + ./src/DF/Makefile \ ./src/DSC/Makefile \ ./src/DSC/DSC_Basic/Makefile \ ./src/DSC/DSC_User/Makefile \ diff --git a/idl/DSC_Engines.idl b/idl/DSC_Engines.idl index 83b558a59..0085608aa 100644 --- a/idl/DSC_Engines.idl +++ b/idl/DSC_Engines.idl @@ -342,6 +342,15 @@ module Engines { void disconnect(in connectionId id, in Engines::DSC::Message message) raises(Engines::ConnectionManager::BadId); + /*! + Shutdown the ConnectionManager process. + */ + oneway void ShutdownWithExit(); + + /*! + Returns the PID of the connection manager + */ + long getPID(); }; /*--------------------------------------------------------------------------------------------*/ diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 8538f9875..6fd42cd02 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -712,6 +712,16 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin void Shutdown(); +/*! + Returns the PID of the server +*/ + long getPID(); + +/*! + Shutdown the StudyManager process. +*/ + oneway void ShutdownWithExit(); + /*! \brief Creation of a new study Creates a new study with a definite name. diff --git a/idl/SALOME_ContainerManager.idl b/idl/SALOME_ContainerManager.idl index fe7700712..5013b402d 100644 --- a/idl/SALOME_ContainerManager.idl +++ b/idl/SALOME_ContainerManager.idl @@ -115,7 +115,12 @@ struct MachineParameters in ResPolicy policy, in CompoList componentList ); + oneway void ShutdownWithExit(); + void ShutdownContainers(); + + long getPID(); + } ; /*! \brief Interface of the %resourcesManager diff --git a/idl/SALOME_ModuleCatalog.idl b/idl/SALOME_ModuleCatalog.idl index 2411a98b0..9fc9dac5b 100644 --- a/idl/SALOME_ModuleCatalog.idl +++ b/idl/SALOME_ModuleCatalog.idl @@ -337,6 +337,16 @@ This interface is used for creation of the module catalog in %SALOME application { void ping(); +/*! + Returns the PID of the server +*/ + long getPID(); + +/*! + Shutdown the ModuleCatalog process. +*/ + oneway void ShutdownWithExit(); + /*! * Get the types of the catalog */ diff --git a/idl/SALOME_Registry.idl b/idl/SALOME_Registry.idl index 8e4433215..5f27977f6 100644 --- a/idl/SALOME_Registry.idl +++ b/idl/SALOME_Registry.idl @@ -48,6 +48,7 @@ module Registry interface Components { void ping(); + long getPID(); unsigned long add ( in Infos lesInfos ) ; void remove ( in unsigned long id ) ; unsigned long size() ; diff --git a/idl/SALOME_Session.idl b/idl/SALOME_Session.idl index f067b753a..041df52a7 100644 --- a/idl/SALOME_Session.idl +++ b/idl/SALOME_Session.idl @@ -101,6 +101,10 @@ module SALOME Determines whether the server has already been loaded or not. */ void ping(); +/*! + Returns the PID of the server +*/ + long getPID(); /*! Get Active study ID */ diff --git a/resources/Makefile.am b/resources/Makefile.am index 0c5dca94a..687202153 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -31,8 +31,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # =============================================================== # -DEPRECATED_FILES=\ - DEPRECATED/Plugin +DEPRECATED_FILES= dist_salomeres_DATA=\ CatalogResources.xml \ diff --git a/src/CASCatch/CASCatch.hxx b/src/CASCatch/CASCatch.hxx deleted file mode 100644 index 03541f951..000000000 --- a/src/CASCatch/CASCatch.hxx +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef _CASCatch_HeaderFile -#define _CASCatch_HeaderFile - -#include -#include - - -#ifdef try -# undef try -#endif - -#ifdef catch -# undef catch -#endif - -#ifdef NO_CXX_EXCEPTION -# if defined(DO_ABORT) -# define CASCatch_TRY \ - Standard_ErrorHandler _Function; \ - K_SETJMP = 1 ; \ - if(DoesNotAbort(_Function)) -# else //If DO_ABORT is not defined -# define CASCatch_TRY \ - Standard_ErrorHandler _Function; \ - if(DoesNotAbort(_Function)) -# endif //DO_ABORT -# define CASCatch_CATCH(Error) \ - else if(_Function.Catches(STANDARD_TYPE(Error))) -#else -# define CASCatch_TRY try -# define CASCatch_CATCH catch -#endif //NO_CXX_EXCEPTION - - -#endif diff --git a/src/CASCatch/CASCatch_CatchSignals.cxx b/src/CASCatch/CASCatch_CatchSignals.cxx deleted file mode 100644 index b039baaa2..000000000 --- a/src/CASCatch/CASCatch_CatchSignals.cxx +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CASCatch_CatchSignals.hxx" - -#include "CASCatch_Failure.hxx" -#include "CASCatch_ErrorHandler.hxx" -#include - -#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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef LIN -#include -#endif - -//============================== -typedef void (ACT_SIGIO_HANDLER)(void) ; - -ACT_SIGIO_HANDLER *ADR_ACT_SIGIO_HANDLER = NULL ; - -typedef void (* SIG_PFV) (int); - -#ifdef SUN -# include -#endif - -#ifdef SOLARIS -# include -# include -# include -# include -#endif - -#include -#include - -#ifdef LIN -# include -# include -#else -# ifdef SA_SIGINFO -# ifndef AIX -# include -# endif -# endif -#endif - - -#ifdef IRIX -# include -# include -#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 - -#include -#include -#include - -#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(); -} - diff --git a/src/CASCatch/CASCatch_CatchSignals.hxx b/src/CASCatch/CASCatch_CatchSignals.hxx deleted file mode 100644 index a3fc42c3e..000000000 --- a/src/CASCatch/CASCatch_CatchSignals.hxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef _CASCatch_CatchSignals_HeaderFile -#define _CASCatch_CatchSignals_HeaderFile - -#include - -/*! - * \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 diff --git a/src/CASCatch/CASCatch_ErrorHandler.cxx b/src/CASCatch/CASCatch_ErrorHandler.cxx deleted file mode 100644 index 49af8d356..000000000 --- a/src/CASCatch/CASCatch_ErrorHandler.cxx +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#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 diff --git a/src/CASCatch/CASCatch_ErrorHandler.hxx b/src/CASCatch/CASCatch_ErrorHandler.hxx deleted file mode 100644 index 05c6b2356..000000000 --- a/src/CASCatch/CASCatch_ErrorHandler.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef _CASCatch_ErrorHandler_HeaderFile -#define _CASCatch_ErrorHandler_HeaderFile - -#include "CASCatch_Failure.hxx" - -#include -#include - - -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 diff --git a/src/CASCatch/CASCatch_Failure.cxx b/src/CASCatch/CASCatch_Failure.cxx deleted file mode 100644 index 6e5d3d884..000000000 --- a/src/CASCatch/CASCatch_Failure.cxx +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CASCatch_Failure.hxx" -#include "CASCatch_ErrorHandler.hxx" -#include -#include -#include - -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 -} - diff --git a/src/CASCatch/CASCatch_Failure.hxx b/src/CASCatch/CASCatch_Failure.hxx deleted file mode 100644 index 102f0ec4e..000000000 --- a/src/CASCatch/CASCatch_Failure.hxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _CASCATCH_FAILURE_HeaderFile -#define _CASCATCH_FAILURE_HeaderFile - -#include -#include -DEFINE_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient ) - -#include - -/*! - * \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 diff --git a/src/CASCatch/Makefile.am b/src/CASCatch/Makefile.am deleted file mode 100644 index 23fc4c7b4..000000000 --- a/src/CASCatch/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG -# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : Makefile.in -# Author : Sergey RUIN (OCN) -# Module : SALOME - -include $(top_srcdir)/salome_adm/unix/make_common_starter.am - - -salomeinclude_HEADERS = CASCatch.hxx \ - CASCatch_CatchSignals.hxx \ - CASCatch_ErrorHandler.hxx \ - CASCatch_Failure.hxx - -lib_LTLIBRARIES = libCASCatch.la -libCASCatch_la_SOURCES = \ - CASCatch_CatchSignals.cxx \ - CASCatch_ErrorHandler.cxx \ - CASCatch_Failure.cxx - -COMMON_CPPFLAGS = \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ - -libCASCatch_la_CPPFLAGS = $(COMMON_CPPFLAGS) -libCASCatch_la_LIBADD = $(CAS_KERNEL) diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 0fc39bd91..1b3fd4bde 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -105,6 +105,21 @@ void SALOME_ContainerManager::Shutdown() _remove_ref(); } +//============================================================================= +/*! CORBA method: + * shutdown the ContainerManager servant and kill the ContainerManager process + */ +//============================================================================= +void SALOME_ContainerManager::ShutdownWithExit() +{ + MESSAGE("ShutdownWithExit"); + PortableServer::ObjectId_var oid = _default_POA()->servant_to_id(this); + _default_POA()->deactivate_object(oid); + _remove_ref(); + + exit( EXIT_SUCCESS ); +} + //============================================================================= /*! CORBA Method: * Loop on all the containers listed in naming service, ask shutdown on each @@ -144,6 +159,16 @@ void SALOME_ContainerManager::ShutdownContainers() } } +//============================================================================= +/*! CORBA Method: + * Returns the PID of the container manager + */ +//============================================================================= +CORBA::Long SALOME_ContainerManager::getPID() +{ + return (CORBA::Long)getpid(); +} + //============================================================================= /*! CORBA Method: * Find a suitable Container in a list of machines, or start one diff --git a/src/Container/SALOME_ContainerManager.hxx b/src/Container/SALOME_ContainerManager.hxx index 34888f98c..b3485ab63 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -60,8 +60,11 @@ public: const Engines::CompoList& componentList); void Shutdown(); + void ShutdownWithExit(); void ShutdownContainers(); + CORBA::Long getPID(); + static const char *_ContainerManagerNameInNS; // Parallel extension diff --git a/src/DF/DF_Application.cxx b/src/DF/DF_Application.cxx new file mode 100644 index 000000000..1e2c50f1b --- /dev/null +++ b/src/DF/DF_Application.cxx @@ -0,0 +1,79 @@ +#include "DF_definitions.hxx" +#include "DF_Application.hxx" + +using namespace std; + +//Constructor +DF_Application::DF_Application() +{ + _currentID = 0; +} + +DF_Application::~DF_Application() +{ + _documents.clear(); +} + +//Creates a new document with given type, returns a smart pointer to +//newly created document. +DF_Document* DF_Application::NewDocument(const string& theDocumentType) +{ + DF_Document* aDoc = new DF_Document(theDocumentType); + aDoc->_id = ++_currentID; + _documents[aDoc->_id] = aDoc; + aDoc->_appli = this; + return aDoc; +} + +//Closes and removes the given Document +void DF_Application::Close(const DF_Document* theDocument) +{ + int id = -1; + if(theDocument) id = theDocument->GetDocumentID(); + + if(_documents.find(id) != _documents.end()) { + _documents[id]->Clear(); + _documents.erase(id); + delete theDocument; + } +} + +//Returns a Document by Document's ID +DF_Document* DF_Application::GetDocument(int theDocumentID) +{ + if(_documents.find(theDocumentID) == _documents.end()) return NULL; + + return _documents[theDocumentID]; +} + +//Returns a list of IDs of all currently opened documents +vector DF_Application::GetDocumentIDs() +{ + vector ids; + typedef map::const_iterator DI; + for(DI p = _documents.begin(); p!=_documents.end(); p++) + ids.push_back(p->first); + return ids; +} + +//Returns a number of existent documents +int DF_Application::NbDocuments() +{ + return _documents.size(); +} + + +//Restores a Document from the given file, returns a smart +//pointer to opened document. +DF_Document* DF_Application::Open(const string& theFileName) +{ + //Not implemented + return NULL; +} + + +//Saves a Document in a given file with name theFileName +void DF_Application::SaveAs(const DF_Document* theDocument, const string& theFileName) +{ + //Not implemented +} diff --git a/src/DF/DF_Application.hxx b/src/DF/DF_Application.hxx new file mode 100644 index 000000000..bae155e73 --- /dev/null +++ b/src/DF/DF_Application.hxx @@ -0,0 +1,47 @@ +#ifndef DFAPPLICATION_HXX +#define DFAPPLICATION_HXX + +#include "DF_definitions.hxx" +#include "DF_Document.hxx" +#include +#include + +//Class DF_Application responsible for creation and manipulation of Documents +class DF_Application { +public: + //Constructor + Standard_EXPORT DF_Application(); + + Standard_EXPORT ~DF_Application(); + + //Creates a new document with given type, returns a smart pointer to + //newly created document. + Standard_EXPORT DF_Document* NewDocument(const std::string& theDocumentType); + + //Closes and removes the given Document + Standard_EXPORT void Close(const DF_Document* theDocument); + + //Returns a Document by Document's ID + Standard_EXPORT DF_Document* GetDocument(int theDocumentID); + + //Returns a list of IDs of all currently opened documents + Standard_EXPORT std::vector GetDocumentIDs(); + + //Returns a number of existent documents + Standard_EXPORT int NbDocuments(); + + //Virtual methods to be redefined if required by specific application + + //Restores a Document from the given file, returns a smart + //pointer to opened document. + Standard_EXPORT virtual DF_Document* Open(const std::string& theFileName); + + //Saves a Document in a given file with name theFileName + Standard_EXPORT virtual void SaveAs(const DF_Document* theDocument, const std::string& theFileName); + +private: + int _currentID; + std::map _documents; + +}; +#endif diff --git a/src/DF/DF_Attribute.cxx b/src/DF/DF_Attribute.cxx new file mode 100644 index 000000000..c392dd9d2 --- /dev/null +++ b/src/DF/DF_Attribute.cxx @@ -0,0 +1,42 @@ +#include "DF_definitions.hxx" +#include "DF_Label.hxx" +#include "DF_Attribute.hxx" + +using namespace std; + +//Class DF_Attribute is used to store some data defined by the DF_Attribute type + +//Constructor +DF_Attribute::DF_Attribute() +{ + _node = NULL; +} + +DF_Attribute::~DF_Attribute() +{ + //Remove an attribute from a map of the node's attributes to + //avoid double deletion on the node destruction + if(_node) { + map::iterator mi; + for(mi =_node->_attributes.begin(); mi != _node->_attributes.end(); mi++) { + if(mi->second == this) { + _node->_attributes.erase(mi); + } + } + } +} + + //Returns a Label on which this Attribute is located. +DF_Label DF_Attribute::Label() const +{ + return DF_Label(_node); +} + + //Searches an Attribute with given ID located on the same Label as this Attribute. +DF_Attribute* DF_Attribute::FindAttribute(const string& theID) const +{ + if(!_node) return NULL; + return Label().FindAttribute(theID); +} + + diff --git a/src/DF/DF_Attribute.hxx b/src/DF/DF_Attribute.hxx new file mode 100644 index 000000000..5d2e65da3 --- /dev/null +++ b/src/DF/DF_Attribute.hxx @@ -0,0 +1,60 @@ +#ifndef DFATTRIBUTE_HXX +#define DFATTRIBUTE_HXX + +#include "DF_definitions.hxx" +#include + +class DF_Label; +class DF_LabelNode; + +//Class DF_Attribute is used to store some data defined by the DF_Attribute type +class DF_Attribute { +protected: + DF_LabelNode* _node; + +public: + //Constructor + Standard_EXPORT DF_Attribute(); + + Standard_EXPORT virtual ~DF_Attribute(); + + //Returns a Label on which this Attribute is located. + Standard_EXPORT DF_Label Label() const; + + //Searches an Attribute with given ID located on the same Label as this Attribute. + Standard_EXPORT DF_Attribute* FindAttribute(const std::string& theID) const; + + + Standard_EXPORT virtual std::string Save() { return ""; } + Standard_EXPORT virtual void Load(const std::string&) {} + + //######## Virtual methods that must be redefined in descendants of the DF_Attribute + + //This method must be redefined in all descendents of the DF_Attribute + //ID is a std::string that uniquely identify the given type of Attributes within the Application. + Standard_EXPORT virtual const std::string& ID() const = 0; + + //Restores a content of this Attribute from another Attribute + Standard_EXPORT virtual void Restore(DF_Attribute* theAttribute) = 0; + + //Creates a new empty copy oà this Attribute + Standard_EXPORT virtual DF_Attribute* NewEmpty() const = 0; + + //Pastes a content of this Attribute into another Attribute + Standard_EXPORT virtual void Paste(DF_Attribute* theIntoAttribute) = 0; + + + //######## Callbacks + + Standard_EXPORT virtual void AfterAddition() {} + Standard_EXPORT virtual void BeforeForget() {} + +protected: + void Backup() {} + + +friend class DF_Label; + +}; + +#endif diff --git a/src/DF/DF_ChildIterator.cxx b/src/DF/DF_ChildIterator.cxx new file mode 100644 index 000000000..fe4573bcb --- /dev/null +++ b/src/DF/DF_ChildIterator.cxx @@ -0,0 +1,80 @@ +#include "DF_ChildIterator.hxx" + +using namespace std; + + +//Constructor +DF_ChildIterator::DF_ChildIterator(const DF_Label& theLabel, bool allLevels) + :_root(NULL), _current(NULL) +{ + Init(theLabel, allLevels); +} + +DF_ChildIterator::DF_ChildIterator() + :_root(NULL), _current(NULL) +{ +} + +DF_ChildIterator::~DF_ChildIterator() +{ + _root = NULL; + _current = NULL; +} + +//Initializes the iterator +void DF_ChildIterator::Init(const DF_Label& theLabel, bool allLevels) +{ + _root = theLabel._node; + _allLevels = allLevels; + if(_root) _current = _root->_firstChild; +} + +//Returns a current Label +DF_Label DF_ChildIterator::Value() +{ + return DF_Label(_current); +} + +//Returns true if there is a current Label +bool DF_ChildIterator::More() +{ + return bool(_current); +} + +//Moves to the next Label +void DF_ChildIterator::Next() +{ + if(!_allLevels) { + _current = _current->_next; //Move to the next brother + return; + } + else { + if(_current->_firstChild) { //Go down to the first child + _current = _current->_firstChild; + } + else { + if(_current->_next) { //Next Brother + _current = _current->_next; + } + else { + if(_current->_father && _current->_father != _root) { + DF_LabelNode *father = _current->_father; + _current = father->_next; + if(!_current) { + while(father && father != _root) { + father = father->_father; + if(father->_next) break; + } + if(father == _root) father = NULL; + if(father) _current = father->_next; + else _current = NULL; + } + } + else { + _current = NULL; //We iterate the whole sub tree + } + } + } + } +} + diff --git a/src/DF/DF_ChildIterator.hxx b/src/DF/DF_ChildIterator.hxx new file mode 100644 index 000000000..54e5ed6bc --- /dev/null +++ b/src/DF/DF_ChildIterator.hxx @@ -0,0 +1,38 @@ +#ifndef DFCHILDITERATOR_HXX +#define DFCHILDITERATOR_HXX + +#include "DF_definitions.hxx" +#include "DF_Label.hxx" + +#include + +//Class DF_ChildIterator is used to iterate a tree of Labels in the Document +class DF_ChildIterator { +public: + //Constructor + Standard_EXPORT DF_ChildIterator(const DF_Label& theLabel, bool allLevels = false); + + Standard_EXPORT DF_ChildIterator(); + + Standard_EXPORT ~DF_ChildIterator(); + + //Initializes the iterator, if allLevels is true the iterator before iterating the next + //brother of the current Label iterates the Label children + Standard_EXPORT void Init(const DF_Label& theLabel, bool allLevels = false); + + //Returns a current Label + Standard_EXPORT DF_Label Value(); + + //Returns true if there is a current Label + Standard_EXPORT bool More(); + + //Moves to the next Label + Standard_EXPORT void Next(); + +private: + DF_LabelNode* _root; + DF_LabelNode* _current; + bool _allLevels; +}; + +#endif diff --git a/src/DF/DF_Container.cxx b/src/DF/DF_Container.cxx new file mode 100644 index 000000000..d5f056486 --- /dev/null +++ b/src/DF/DF_Container.cxx @@ -0,0 +1,196 @@ +#include "DF_definitions.hxx" +#include "DF_Label.hxx" +#include "DF_Container.hxx" + +using namespace std; + +//Static method that returns an ID of the give type of attributes +const string& DF_Container::GetID() +{ + static string id = "DF_Container_srn"; + return id; +} + +//Creates if not exists a Container attribute and places if is not placed it the Label +DF_Container* DF_Container::Set(DF_Label& theLabel) +{ + DF_Attribute* attr = NULL; + if(!(attr = theLabel.FindAttribute(DF_Container::GetID()))) { + attr = new DF_Container; + theLabel.AddAttribute(attr); + } + + return dynamic_cast(attr); +} + +//Constructor +DF_Container::DF_Container() +{ + _ints.clear(); + _doubles.clear(); + _bools.clear(); + _strings.clear(); +} + +//Destructor +DF_Container::~DF_Container() +{ + _ints.clear(); + _doubles.clear(); + _bools.clear(); + _strings.clear(); +} + +//Sets an integer value of the attribute with given ID +void DF_Container::SetInt(const string& theID, int theValue) +{ + _ints[theID] = theValue; +} + +//Returns an integer value of the attribute with given ID +int DF_Container::GetInt(const string& theID) +{ + if(!HasIntID(theID)) + return 0; + return _ints[theID]; +} + +//Returns True if there is an integer with given ID +bool DF_Container::HasIntID(const string& theID) +{ + if(_ints.find(theID) != _ints.end()) return true; + return false; +} + +//Sets a double value of the attribute with given ID +void DF_Container::SetDouble(const string& theID, const double& theValue) +{ + _doubles[theID] = theValue; +} + + +//Returns a double value of the attribute with given ID +double DF_Container::GetDouble(const string& theID) +{ + if(!HasDoubleID(theID)) return 0.0; + return _doubles[theID]; +} + +//Returns True if there is a double with given ID +bool DF_Container::HasDoubleID(const string& theID) +{ + if(_doubles.find(theID) != _doubles.end()) return true; + return false; +} + +//Sets a string value of the attribute with given ID +void DF_Container::SetString(const string& theID, const string& theValue) +{ + _strings[theID] = theValue; +} + +//Returns a string value of the attribute with given ID +string DF_Container::GetString(const string& theID) +{ + if(!HasStringID(theID)) return ""; + return _strings[theID]; +} + +//Returns True if there is a string with given ID +bool DF_Container::HasStringID(const string& theID) +{ + if(_strings.find(theID) != _strings.end()) return true; + return false; +} + +//Sets a boolean value of the attribute with given ID +void DF_Container::SetBool(const string& theID, bool theValue) +{ + _bools[theID] = theValue; +} + +//Returns a boolean value of the attribute with given ID +bool DF_Container::GetBool(const string& theID) +{ + if(!HasBoolID(theID)) return false; + return _bools[theID]; +} + +//Returns True if there is a boolean value with given ID +bool DF_Container::HasBoolID(const string& theID) +{ + if(_bools.find(theID) != _bools.end()) return true; + return false; +} + +//Clears a content of the attribute +void DF_Container::Clear() +{ + _ints.clear(); + _doubles.clear(); + _strings.clear(); + _bools.clear(); +} + +//ID is a string that uniquely identify the given type of Attributes within the Application. +const string& DF_Container::ID() const +{ + return GetID(); +} + +//Restores a content of this Attribute from another Attribute +void DF_Container::Restore(DF_Attribute* theAttribute) +{ + Clear(); + + DF_Container* attr = dynamic_cast(theAttribute); + if(!attr) return; + + typedef map::const_iterator SI; + for(SI p = attr->_ints.begin(); p != attr->_ints.end(); p++) + _ints[p->first] = p->second; + + typedef map::const_iterator SD; + for(SD p = attr->_doubles.begin(); p != attr->_doubles.end(); p++) + _doubles[p->first] = p->second; + + typedef map::const_iterator SS; + for(SS p = attr->_strings.begin(); p != attr->_strings.end(); p++) + _strings[p->first] = p->second; + + typedef map::const_iterator SB; + for(SB p = attr->_bools.begin(); p != attr->_bools.end(); p++) + _bools[p->first] = p->second; +} + +//Creates a new empty copy oà this Attribute +DF_Attribute* DF_Container::NewEmpty() const +{ + return new DF_Container(); +} + +//Pastes a content of this Attribute into another Attribute +void DF_Container::Paste(DF_Attribute* theIntoAttribute) +{ + DF_Container* attr = dynamic_cast(theIntoAttribute); + if(!attr) return; + + attr->Clear(); + + typedef map::const_iterator SI; + for(SI p = _ints.begin(); p != _ints.end(); p++) + attr->_ints[p->first] = p->second; + + typedef map::const_iterator SD; + for(SD p = _doubles.begin(); p != _doubles.end(); p++) + attr->_doubles[p->first] = p->second; + + typedef map::const_iterator SS; + for(SS p = _strings.begin(); p != _strings.end(); p++) + attr->_strings[p->first] = p->second; + + typedef map::const_iterator SB; + for(SB p = _bools.begin(); p != _bools.end(); p++) + attr-> _bools[p->first] = p->second; +} + diff --git a/src/DF/DF_Container.hxx b/src/DF/DF_Container.hxx new file mode 100644 index 000000000..f26ce8d9e --- /dev/null +++ b/src/DF/DF_Container.hxx @@ -0,0 +1,85 @@ +#ifndef DFCONTAINER_HXX +#define DFCONTAINER_HXX + +#include "DF_definitions.hxx" +#include "DF_Attribute.hxx" +#include +#include + +//Class DF_Container is used to store several types of data +class DF_Container : public DF_Attribute +{ +public: + + //Static method that returns an ID of the give type of attributes + Standard_EXPORT static const std::string& GetID(); + + //Creates if not exists a Container attribute and places if is not placed it the Label + Standard_EXPORT static DF_Container* Set(DF_Label& theLabel); + + //Constructor + Standard_EXPORT DF_Container(); + + //Destructor + Standard_EXPORT ~DF_Container(); + + //Sets an integer value of the attribute with given ID + Standard_EXPORT void SetInt(const std::string& theID, int theValue); + + //Returns an integer value of the attribute with given ID + Standard_EXPORT int GetInt(const std::string& theID); + + //Returns True if there is an integer with given ID + Standard_EXPORT bool HasIntID(const std::string& theID); + + //Sets a double value of the attribute with given ID + Standard_EXPORT void SetDouble(const std::string& theID, const double& theValue); + + //Returns a double value of the attribute with given ID + Standard_EXPORT double GetDouble(const std::string& theID); + + //Returns True if there is a double with given ID + Standard_EXPORT bool HasDoubleID(const std::string& theID); + + //Sets a string value of the attribute with given ID + Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue); + + //Returns a string value of the attribute with given ID + Standard_EXPORT std::string GetString(const std::string& theID); + + //Returns True if there is a string with given ID + Standard_EXPORT bool HasStringID(const std::string& theID); + + //Sets a boolean value of the attribute with given ID + Standard_EXPORT void SetBool(const std::string& theID, bool theValue); + + //Returns a boolean value of the attribute with given ID + Standard_EXPORT bool GetBool(const std::string& theID); + + //Returns True if there is a boolean value with given ID + Standard_EXPORT bool HasBoolID(const std::string& theID); + + //Clears a content of the attribute + Standard_EXPORT void Clear(); + + //ID is a std::string that uniquely identify the given type of Attributes within the Application. + Standard_EXPORT virtual const std::string& ID() const; + + //Restores a content of this Attribute from another Attribute + Standard_EXPORT virtual void Restore(DF_Attribute* theAttribute); + + //Creates a new empty copy of this Attribute + Standard_EXPORT virtual DF_Attribute* NewEmpty() const; + + //Pastes a content of this Attribute into another Attribute + Standard_EXPORT virtual void Paste(DF_Attribute* theIntoAttribute); + + +protected: + std::map _ints; + std::map _doubles; + std::map _strings; + std::map _bools; +}; + +#endif diff --git a/src/DF/DF_Document.cxx b/src/DF/DF_Document.cxx new file mode 100644 index 000000000..47b9516e7 --- /dev/null +++ b/src/DF/DF_Document.cxx @@ -0,0 +1,125 @@ +#include "DF_definitions.hxx" +#include "DF_Document.hxx" +#include "DF_Label.hxx" +#include "DF_ChildIterator.hxx" + +using namespace std; + +//Class DF_Document is container for user's data stored as a tree of Labels +//with assigned Attributes + +DF_Document::DF_Document(const string& theDocumentType) +{ + _id = -1; + _type = theDocumentType; + _modified = true; +} + +DF_Document::~DF_Document() +{ + Clear(); +} + +DF_Application* DF_Document::GetApplication() +{ + return _appli; +} + +//Returns a Label of this Document with entry "0:1" +DF_Label DF_Document::Main() +{ + if(!_main.IsNull()) return _main; + + if(_root.IsNull()) { + _root = DF_Label(new DF_LabelNode()); + _root._node->_document = this; + } + + _main = _root.FindChild(1, true); + + return _main; +} + +//Returns a Label of this Document with entry "0:" +DF_Label DF_Document::Root() +{ + if(!_root.IsNull()) return _root; + + if(_root.IsNull()) { + _root = DF_Label(new DF_LabelNode()); + _root._node->_document = this; + } + + return _root; +} + + +//Returns an ID of this +int DF_Document::GetDocumentID() const +{ + return _id; +} + +//Returns a type of the Document +string DF_Document::GetDocumentType() +{ + return _type; +} + +//Clears the content of this Document +void DF_Document::Clear() +{ + if(_root.IsNull()) return; + + vector vn; + DF_ChildIterator CI(_root, true); + for(; CI.More(); CI.Next()) { + DF_LabelNode* node = CI.Value()._node; + if(node) vn.push_back(node); + } + + for(int i = 0, len = vn.size(); iReset(); +} + +//Returns true if this document is empty +bool DF_Document::IsEmpty() +{ + if(_root.IsNull()) return true; + + DF_ChildIterator CI(_root, true); + for(; CI.More(); CI.Next()) { + DF_LabelNode* node = CI.Value()._node; + if(node->_attributes.size()) return false; + } + + return true; +} + +//Returns true if this document is modified +bool DF_Document::IsModified() +{ + return _modified; +} + +//Sets whether a document is modified +void DF_Document::SetModified(bool isModified) +{ + _modified = isModified; +} + + +//Restores a content of the Document from the std::string theData +void DF_Document::Load(const std::string& theData) +{ + //Not implemented +} + +//Converts a content of the Document into the std::string +string DF_Document::Save() +{ + //Not implemented + return ""; +} diff --git a/src/DF/DF_Document.hxx b/src/DF/DF_Document.hxx new file mode 100644 index 000000000..de51652ae --- /dev/null +++ b/src/DF/DF_Document.hxx @@ -0,0 +1,65 @@ +#ifndef DFDOCUMENT_HXX +#define DFDOCUMENT_HXX + +#include "DF_definitions.hxx" +#include "DF_Label.hxx" + +#include + +class DF_Application; + +//Class DF_Document is container for user's data stored as a tree of Labels +//with assigned Attributes +class DF_Document { +public: + //Constructor + Standard_EXPORT DF_Document(const std::string& theDocumentType); + + Standard_EXPORT ~DF_Document(); + + Standard_EXPORT DF_Application* GetApplication(); + + //Returns a Label of this Document with entry "0:1" + Standard_EXPORT DF_Label Main(); + + //Returns a root Label with entry "0:" + Standard_EXPORT DF_Label Root(); + + //Returns an ID of this + Standard_EXPORT int GetDocumentID() const; + + //Returns a type of the Document + Standard_EXPORT std::string GetDocumentType(); + + //Clears the content of this Document + Standard_EXPORT void Clear(); + + //Returns true if this document is empty + Standard_EXPORT bool IsEmpty(); + + //Returns true if this document is modified + Standard_EXPORT bool IsModified(); + + //Returns true if this document is modified + Standard_EXPORT void SetModified(bool isModified); + + //########### Load/Save virtual methods ## + + //Restores a content of the Document from the std::string theData + Standard_EXPORT virtual void Load(const std::string& theData); + + //Converts a content of the Document into the std::string + Standard_EXPORT virtual std::string Save(); + + friend class DF_Application; + +private: + DF_Label _main; + DF_Label _root; + std::string _type; + int _id; + bool _modified; + DF_Application* _appli; +}; + +#endif diff --git a/src/DF/DF_Label.cxx b/src/DF/DF_Label.cxx new file mode 100644 index 000000000..453630a3f --- /dev/null +++ b/src/DF/DF_Label.cxx @@ -0,0 +1,473 @@ +#include "DF_definitions.hxx" +#include "DF_Label.hxx" +#include "DF_Document.hxx" +#include "DF_Attribute.hxx" +#include "DF_ChildIterator.hxx" + +#include + +using namespace std; + +//Class DF_Label defines a persistence reference in DF_Document that contains a tree of Labels. +//This reference is named "entry" and is a sequence of tags divided by ":". The root entry is "0:". +//For example "0:1:1" corresponds the following structure +// 0_ +// | +// |_1_ +// | +// |_ 1 + +DF_Label DF_Label::Label(const DF_Label& theLabel, const string& theEntry, bool isCreated) +{ + if(theLabel.IsNull()) return DF_Label(); + + DF_Label aLabel = theLabel.Root(); + if(theEntry == "0:") return aLabel; + if(theEntry == "0:1") return theLabel.GetDocument()->Main(); + + char* cc = (char*)theEntry.c_str(); + int n = 0; + vector tags; + + while (*cc != '\0') { + while ( *cc >= '0' && *cc <= '9') { + n = 10*n + (*cc - '0'); + ++cc; + } + if (*cc == ':' || *cc == '\0') { + tags.push_back(n); + n = 0; + if (*cc != '\0') ++cc; + } + else { + tags.clear(); + break; + } + } + + if(!tags.size()) return DF_Label(); + + for(int i = 1, len = tags.size(); !aLabel.IsNull() && i_document; +} + +//Returns true if theLabel equals to this label +bool DF_Label::operator==(const DF_Label& theLabel) +{ + if(IsNull() || theLabel.IsNull()) return false; + return (theLabel.Entry() == Entry()); +} + +//Returns true if theLabel doesn't equals to this label +bool DF_Label::operator!=(const DF_Label& theLabel) +{ + if(IsNull() || theLabel.IsNull()) return true; + return (theLabel.Entry() != Entry()); +} + + +//Returns a tag of this Label +int DF_Label::Tag() const +{ + if(!_node) return -1; + return _node->_tag; +} + +//Returns true if this Label is attached to the tree in the Document. +bool DF_Label::IsAttached() +{ + if(!_node) return false; + return (bool)(_node->_document); +} + +//Searches an Attribute with given ID located on this Label. +//Returns true if the Attribute is found. +DF_Attribute* DF_Label::FindAttribute(const std::string& theID) const +{ + if(!_node) return NULL; + + if(_node->_attributes.find(theID) == _node->_attributes.end()) return NULL; + return _node->_attributes[theID]; +} + +//Returns true if there is an Attribute with given ID on this Label. +bool DF_Label::IsAttribute(const std::string& theID) const +{ + if(!_node) return false; + + return (_node->_attributes.find(theID) != _node->_attributes.end()); +} + +//Adds theAttribute to the Label where this Attribute is located. +//Returns true if theAttribute was added. +bool DF_Label::AddAttribute(DF_Attribute* theAttribute) const +{ + if(!_node) return false; + + if(_node->_attributes.find(theAttribute->ID()) != _node->_attributes.end()) return false; + theAttribute->_node = _node; + _node->_attributes[theAttribute->ID()] = theAttribute; + + return true; +} + +//Forgets an Attribute with given ID located on the this Label. +bool DF_Label::ForgetAttribute(const std::string& theID) const +{ + if(!_node) return false; + + if(_node->_attributes.find(theID) == _node->_attributes.end()) return false; + DF_Attribute* attr = _node->_attributes[theID]; + _node->_attributes.erase(theID); + delete attr; + + return true; +} + +//Forgets all Attributes located on this Label. +bool DF_Label::ForgetAllAttributes(bool clearChildren) const +{ + if(!_node) return false; + + vector va = GetAttributes(); + _node->_attributes.clear(); + + for(int i = 0, len = va.size(); i_father; +} + +//Returns is this Label is not initialized +bool DF_Label::IsNull() const +{ + return (!_node || (_node->_document == NULL)); +} + +//Returns is this Label is a Root label +bool DF_Label::IsRoot() const +{ + if(IsNull() || Father().IsNull()) return true; + return false; +} + + +//Returns true if this Label has Attributes. +bool DF_Label::HasAttributes() const +{ + if(!_node) return false; + + return !(_node->_attributes.empty()); +} + +//Returns a list of Attributes of this Label. +vector DF_Label::GetAttributes() const +{ + vector attributes; + if(!_node) return attributes; + + typedef map::const_iterator AI; + vector sorted; + for(AI p = _node->_attributes.begin(); p!=_node->_attributes.end(); p++) + sorted.push_back(p->first); + + sort(sorted.begin(), sorted.end()); + int len = sorted.size(); + for(int i = 0; i_attributes[sorted[i]]); + + return attributes; +} + +//Returns true if this Label has a child Label. +bool DF_Label::HasChild() const +{ + if(!_node) return false; + + return (bool)(_node->_firstChild); +} + +//Returns a number of child Labels. +int DF_Label::NbChildren() const +{ + if(!_node) return -1; + + if(!_node->_firstChild) return 0; + int nb = 1; + DF_LabelNode* next = _node->_firstChild->_next; + while(next) { + nb++; + next = next->_next; + } + + return nb; +} + +//Returns the depth (a number of fathers required to identify the Label) of this Label in the tree. +int DF_Label::Depth() const +{ + if(!_node) return -1; + + return _node->_depth; +} + +//Returns true if this Label is a descendant of theLabel. +bool DF_Label::IsDescendant(const DF_Label& theLabel) +{ + if(!_node) return false; + + DF_LabelNode* father = _node->_father; + if(!father) return false; + + while(father) { + if(father == theLabel._node) return true; + father = father->_father; + } + + return false; +} + +//Returns the root Label of a Label tree to which this Label belongs. +DF_Label DF_Label::Root() const +{ + if(!_node) return DF_Label(); + + return _node->_document->Main().Father(); +} + +//Finds a child Label of this Label with a given tag. If isCreate = true and there is no child +//Label with the given tag, the child Label is created. +DF_Label DF_Label::FindChild(int theTag, bool isCreate) +{ + if(!_node || IsNull()) return DF_Label(); + + DF_LabelNode *aLabel = NULL, *aPrevious = NULL, *aNext = NULL; + if(!_node->_firstChild && !isCreate) return DF_Label(); + + if(_node->_firstChild && _node->_firstChild->_tag == theTag) + return DF_Label(_node->_firstChild); + + if(_node->_lastChild) { + if(_node->_lastChild->_tag == theTag) return DF_Label(_node->_lastChild); + if(_node->_lastChild->_tag < theTag) aPrevious = _node->_lastChild; + } + + if(!aPrevious) { + aLabel = _node->_firstChild; + while(aLabel) { + if(aLabel->_tag == theTag) return DF_Label(aLabel); + if(aLabel->_tag > theTag) { + aNext = aLabel; + break; + } + if(aLabel->_tag < theTag) aPrevious = aLabel; + aLabel = aLabel->_next; + } + } + + if(!isCreate) return DF_Label(); + + DF_LabelNode* aChild = new DF_LabelNode(); + aChild->_father = this->_node; + aChild->_document = _node->_document; + aChild->_tag = theTag; + aChild->_depth = _node->_depth+1; + if(aNext) { + aChild->_previous = aNext->_previous; + aChild->_next = aNext; + aNext->_previous = aChild; + } + if(aPrevious) { + aChild->_previous = aPrevious; + aChild->_next = aPrevious->_next; + aPrevious->_next = aChild; + } + + if(!_node->_firstChild || (aNext && aNext == _node->_firstChild) ) _node->_firstChild = aChild; + if(!_node->_lastChild || !aNext) _node->_lastChild = aChild; + + return aChild; +} + +//Creates a new child Label of this Label. +DF_Label DF_Label::NewChild() +{ + if(!_node || IsNull()) return DF_Label(); + + int tag = 1; + if(_node->_lastChild) tag = _node->_lastChild->_tag+1; + + return FindChild(tag, true); +} + +//Returns a string entry of this Label +string DF_Label::Entry() const +{ + string entry = ""; + vector vi; + DF_LabelNode* father = this->_node; + while(father) { + vi.push_back(father->_tag); + father = father->_father; + } + + int len = vi.size(); + if(len == 1) { + entry = "0:"; + } + else { + char buffer[128]; + for(int i = len-1; i>=0; i--) { + int tag = vi[i]; + sprintf(buffer, "%d", tag); + entry+=string(buffer); + if(i) entry += ":"; + } + } + + return entry; +} + +bool DF_Label::IsEqual(const DF_Label& theLabel) +{ + if(theLabel.IsNull() || IsNull()) return false; + DF_Label L(theLabel); + return (L.Entry() == Entry()); +} + + +void DF_Label::Nullify() +{ + delete _node; + _node = NULL; +} + +void DF_Label::dump() +{ + if(!_node) cout << "DF_Label addr : " << this << " NULL " << endl; + else { + cout << "DF_Label addr : " << this->_node << " entry : " << Entry() << endl; + if(_node->_father) cout << " Father : " << _node->_father << " entry : " << Father().Entry() << endl; + else cout << " Father : NULL " << endl; + + if(_node->_firstChild) cout << " FirstChild : " << _node->_firstChild << " entry : " << DF_Label(_node->_firstChild).Entry() << endl; + else cout << " FirstChild : NULL " << endl; + + if(_node->_lastChild) cout << " LastChild : " << _node->_lastChild << " entry : " << DF_Label(_node->_lastChild).Entry() << endl; + else cout << " LastChild : NULL " << endl; + + if(_node->_previous) cout << " Previous : " << _node->_previous << " entry : " << DF_Label(_node->_previous).Entry() << endl; + else cout << " Previous : NULL " << endl; + + if(_node->_next) cout << " Next : " << _node->_next << " entry : " << DF_Label(_node->_next).Entry() << endl; + else cout << " Next : NULL " << endl; + } +} + + +/* + ############################################### + DF_LabelNode methods + ############################################### +*/ + +DF_LabelNode::DF_LabelNode() +{ + _depth = 0; + _tag = 0; + _attributes.clear(); + _document = NULL; + _father = NULL; + _firstChild = NULL; + _lastChild = NULL; + _previous = NULL; + _next = NULL; +} + +DF_LabelNode::~DF_LabelNode() +{ + vector va; + typedef map::const_iterator AI; + for(AI p = _attributes.begin(); p!=_attributes.end(); p++) + va.push_back(p->second); + + for(int i = 0, len = va.size(); i va; + typedef map::const_iterator AI; + for(AI p = _attributes.begin(); p!=_attributes.end(); p++) + va.push_back(p->second); + + for(int i = 0, len = va.size(); i +#include +#include + +class DF_Document; + + +class DF_LabelNode +{ +public: + DF_LabelNode(); + ~DF_LabelNode(); + void Reset(); +private: + int _tag; + int _depth; + DF_LabelNode* _father; + DF_LabelNode* _previous; + DF_LabelNode* _next; + DF_LabelNode* _firstChild; + DF_LabelNode* _lastChild; + DF_Document* _document; + std::map< std::string, DF_Attribute* > _attributes; + + friend class DF_Document; + friend class DF_Label; + friend class DF_ChildIterator; + friend class DF_Attribute; +}; + +//Class DF_Label defines a persistence reference in DF_Document that contains a tree of Labels. +//This reference is named "entry" and is a sequence of tags divided by ":". The root entry is "0:". +//For example "0:1:1" corresponds the following structure +// 0_ +// | +// |_1_ +// | +// |_ 1 + +class DF_Label { +public: + + //Returns a Label by its entry, if isCreated true the Label will be created if not exists + Standard_EXPORT static DF_Label Label(const DF_Label& theLabel, const std::string& theEntry, bool isCreated = true); + + //Constructors: creates a root label + Standard_EXPORT DF_Label(); + + //Copy constructor + Standard_EXPORT DF_Label(const DF_Label& theLabel); + + //Creates a Label from the LabelNode + Standard_EXPORT DF_Label(DF_LabelNode* theNode); + + //Operator = + Standard_EXPORT DF_Label& operator=(const DF_Label& theLabel); + + //Destructor + Standard_EXPORT ~DF_Label(); + + //Returns a smart pointer to Document which contains this Label + Standard_EXPORT DF_Document* GetDocument() const; + + //Returns true if theLabel equals to this label + Standard_EXPORT bool operator==(const DF_Label& theLabel); + + //Returns true if theLabel doesn't equals to this label + Standard_EXPORT bool operator!=(const DF_Label& theLabel); + + //Returns a tag of this Label + Standard_EXPORT int Tag() const; + + //Returns true if this Label is attached to the tree in the Document. + Standard_EXPORT bool IsAttached(); + + //Searches an Attribute with given ID located on this Label. + //Returns true if the Attribute is found. + Standard_EXPORT DF_Attribute* FindAttribute(const std::string& theID) const; + + //Returns true if there is an Attribute with given ID on this Label. + Standard_EXPORT bool IsAttribute(const std::string& theID) const; + + //Adds theAttribute to the Label where this Attribute is located. + //Returns true if theAttribute was added. + Standard_EXPORT bool AddAttribute(DF_Attribute* theAttribute) const; + + //Forgets an Attribute with given ID located on the this Label. + Standard_EXPORT bool ForgetAttribute(const std::string& theID) const; + + //Forgets all Attributes located on this Label. + Standard_EXPORT bool ForgetAllAttributes(bool clearChildren = true) const; + + //Returns Father of this Label. + Standard_EXPORT DF_Label Father() const; + + //Return true if the label is not initialized + Standard_EXPORT bool IsNull() const; + + //Return true if the label is a Root label + Standard_EXPORT bool IsRoot() const; + + //Returns true if this Label has Attributes. + Standard_EXPORT bool HasAttributes() const; + + //Returns a list of Attributes of this Label. + Standard_EXPORT std::vector GetAttributes() const; + + //Returns true if this Label has a child Label. + Standard_EXPORT bool HasChild() const; + + //Returns a number of child Labels. + Standard_EXPORT int NbChildren() const; + + //Returns the depth (a number of fathers required to identify the Label) of this Label in the tree. + Standard_EXPORT int Depth() const; + + //Returns true if this Label is a descendant of theLabel. + Standard_EXPORT bool IsDescendant(const DF_Label& theLabel); + + //Returns the root Label of a Label tree to which this Label belongs. + Standard_EXPORT DF_Label Root() const; + + //Finds a child Label of this Label with a given tag. If isCreate = true and there is no child + //Label with the given tag, the child Label is created. + Standard_EXPORT DF_Label FindChild(int theTag, bool isCreate = true); + + //Creates a new child Label of this Label. + Standard_EXPORT DF_Label NewChild(); + + //Returns a string presentation of the entry + Standard_EXPORT std::string Entry() const; + + //Returns true if theLabel is the same as me + Standard_EXPORT bool IsEqual(const DF_Label& theLabel); + + Standard_EXPORT void dump(); + +private: + //Nullifies the content of the label + void Nullify(); + +friend class DF_Document; +friend class DF_ChildIterator; + +private: + DF_LabelNode* _node; +}; + +#endif diff --git a/src/DF/DF_definitions.hxx b/src/DF/DF_definitions.hxx new file mode 100644 index 000000000..816839cfa --- /dev/null +++ b/src/DF/DF_definitions.hxx @@ -0,0 +1,125 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef DF_DEF_HXX +#define DF_DEF_HXX + +#ifdef WIN32 +# ifdef DF_EXPORTS +# define DF_EXPORT __declspec( dllexport ) +# else +# define DF_EXPORT __declspec( dllimport ) +# endif +#else +# define DF_EXPORT +#endif + +#include +#include +#include + +template class df_shared_ptr: public boost::shared_ptr +{ +public: + df_shared_ptr() {} + + template + explicit df_shared_ptr(Y * p) + { + boost::shared_ptr::reset(p); + } + + template + df_shared_ptr(df_shared_ptr const & r): + boost::shared_ptr(r,boost::detail::dynamic_cast_tag()) + {} + + template + df_shared_ptr & operator=(df_shared_ptr const & r) + { + df_shared_ptr(r).swap(*this); + return *this; + } + + template df_shared_ptr& operator()(Y * p) // Y must be complete + { + if(T* pt = dynamic_cast(p)) + boost::shared_ptr::reset(pt); + else + boost::throw_exception(std::bad_cast()); + return *this; + } + +}; + +# if defined(WNT) && !defined(HAVE_NO_DLL) + +# ifndef Standard_EXPORT +# define Standard_EXPORT __declspec( dllexport ) +// For global variables : +# define Standard_EXPORTEXTERN __declspec( dllexport ) extern +# define Standard_EXPORTEXTERNC extern "C" __declspec( dllexport ) +# endif /* Standard_EXPORT */ + +# ifndef Standard_IMPORT +# define Standard_IMPORT __declspec( dllimport ) extern +# define Standard_IMPORTC extern "C" __declspec( dllimport ) +# endif /* Standard_IMPORT */ + +# else /* WNT */ + +# ifndef Standard_EXPORT +# define Standard_EXPORT +// For global variables : +# define Standard_EXPORTEXTERN extern +# define Standard_EXPORTEXTERNC extern "C" +# endif /* Standard_EXPORT */ + +# ifndef Standard_IMPORT +# define Standard_IMPORT extern +# define Standard_IMPORTC extern "C" +# endif /* Standard_IMPORT */ + +# endif /* WNT */ + +# ifndef __Standard_API +//# ifdef WNT +# if !defined(WNT) +# define __Standard_API Standard_EXPORT +# define __Standard_APIEXTERN Standard_EXPORTEXTERN +# else +# define __Standard_API Standard_IMPORT +# define __Standard_APIEXTERN Standard_IMPORT +# endif // __Standard_DLL +//# else +//# define __Standard_API +//# endif // WNT +# endif // __Standard_API + +#include +class Standard_EXPORT DFexception +{ +public : + DFexception(const char *message) { + std::cerr << message << std::endl; + } +}; + + +#endif diff --git a/src/DF/Makefile.am b/src/DF/Makefile.am new file mode 100644 index 000000000..00dabed07 --- /dev/null +++ b/src/DF/Makefile.am @@ -0,0 +1,99 @@ +# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG +# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# File : Makefile.am +# Author : Guillaume Boulant (CSSI) +# Module : KERNEL + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + +# +# =============================================================== +# Files to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS= \ + DF_Attribute.hxx \ + DF_Label.hxx \ + DF_Application.hxx \ + DF_Document.hxx \ + DF_ChildIterator.hxx \ + DF_Container.hxx \ + DF_definitions.hxx + +# +# =============================================================== +# Local definitions +# =============================================================== +# + +# This local variable defines the list of CPPFLAGS common to all target in this package. +COMMON_CPPFLAGS=\ + -I$(srcdir)/../Basics \ + -I$(srcdir)/../SALOMELocalTrace \ + -I$(srcdir)/../HDFPersist \ + @HDF5_INCLUDES@ \ + @BOOST_CPPFLAGS@ + +# This flag is used to resolve the dependencies of OCC libraries. +LDXMUFLAGS = -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lXmu + +# This local variable defines the list of dependant libraries common to all target in this package. +COMMON_LIBS =\ + ../HDFPersist/libSalomeHDFPersist.la \ + @HDF5_LIBS@ \ + $(LDXMUFLAGS) + + +# +# =============================================================== +# Libraries targets +# =============================================================== +# +lib_LTLIBRARIES = libDF.la +libDF_la_SOURCES = \ + DF_Attribute.cxx \ + DF_Label.cxx \ + DF_Document.cxx \ + DF_Application.cxx \ + DF_ChildIterator.cxx \ + DF_Container.cxx \ +\ + DF_Attribute.hxx \ + DF_Label.hxx \ + DF_Application.hxx \ + DF_Document.hxx \ + DF_ChildIterator.hxx \ + DF_Container.hxx \ + DF_definitions.hxx + +libDF_la_CPPFLAGS = $(COMMON_CPPFLAGS) +libDF_la_LDFLAGS = -no-undefined -version-info=0:0:0 +libDF_la_LIBADD = $(COMMON_LIBS) + +# +# =============================================================== +# Executables targets +# =============================================================== +# +bin_PROGRAMS = testDF +testDF_SOURCES = testDF.cxx +testDF_CPPFLAGS = $(COMMON_CPPFLAGS) +testDF_LDADD = libDF.la $(COMMON_LIBS) + diff --git a/src/DF/testDF.cxx b/src/DF/testDF.cxx new file mode 100644 index 000000000..69dd8920c --- /dev/null +++ b/src/DF/testDF.cxx @@ -0,0 +1,311 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +//File: testDF.cxx +//Author: Sergey RUIN + +#include +#include +#include +#include + +#include "DF_definitions.hxx" +#include "DF_Application.hxx" +#include "DF_Document.hxx" +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include "DF_Container.hxx" +#include "DF_ChildIterator.hxx" + +#ifndef WNT +#include +#include +#include +#include +#else +#include +#include +#endif + +using namespace std; + +void printStr(const string& theValue) +{ + cout << "printStr: " << theValue << endl; +} + +void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds) +{ +#ifdef WNT + SYSTEMTIME st; + + GetLocalTime ( &st ); + + month = st.wMonth; + day = st.wDay; + year = st.wYear; + hours = st.wHour; + minutes = st.wMinute; + seconds = st.wSecond; +#else + struct tm transfert; + struct timeval tval; + struct timezone tzone; + int status; + + status = gettimeofday( &tval, &tzone ); + memcpy(&transfert, localtime((time_t *)&tval.tv_sec), sizeof(tm)); + + month = transfert.tm_mon + 1; + day = transfert.tm_mday; + year = transfert.tm_year + 1900; + hours = transfert.tm_hour; + minutes = transfert.tm_min ; + seconds = transfert.tm_sec ; +#endif +} + +string GetUserName() +{ +#ifdef WNT + char* pBuff = new char[UNLEN + 1]; + DWORD dwSize = UNLEN + 1; + string retVal; + GetUserName ( pBuff, &dwSize ); + string theTmpUserName(pBuff,(int)dwSize -1 ); + retVal = theTmpUserName; + delete [] pBuff; + return retVal; +#else + struct passwd *infos; + infos = getpwuid(getuid()); + return string(infos->pw_name); +#endif +} + +string GetNameFromPath(const string& thePath) { + if (thePath.empty()) return ""; + int pos1 = thePath.rfind('/'); + int pos2 = thePath.rfind('\\'); + if(pos1 > 0) return thePath.substr(pos1+1, thePath.size()); + if(pos2 > 0) return thePath.substr(pos2+1, thePath.size()); + return thePath; +} + +string GetDirFromPath(const string& thePath) { + if (thePath.empty()) return ""; + + int pos = thePath.rfind('/'); + string path; + if(pos > 0) { + path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('\\'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('|'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + path = thePath+"/"; + } + +#ifdef WNT //Check if the only disk letter is given as path + if(path.size() == 2 && path[1] == ":") path +='\\'; +#endif + + for(int i = 0, len = path.size(); i splitString(const string& theValue, char separator) +{ + vector vs; + if(theValue[0] == separator && theValue.size() == 1) return vs; + int pos = theValue.find(separator); + if(pos < 0) { + vs.push_back(theValue); + return vs; + } + + string s = theValue; + if(s[0] == separator) s = s.substr(1, s.size()); + while((pos = s.find(separator)) >= 0) { + vs.push_back(s.substr(0, pos)); + s = s.substr(pos+1, s.size()); + } + + if(!s.empty() && s[0] != separator) vs.push_back(s); + return vs; +} + + +int main (int argc, char * argv[]) +{ + cout << "Test started " << endl; + + DF_Application* appli = new DF_Application; + DF_Document* doc1 = appli->NewDocument("doc_1"); + + /* + DF_Label root1 = doc1->Main(); + DF_Label child = root1.FindChild(3, true); //0:1:3 + + DF_Container* attr1 = DF_Container::Set(child); + attr1->SetInt("eighteen", 18); + + + DF_Attribute* attr = NULL; + if(!(attr = child.FindAttribute(DF_Container::GetID()))) { + cout << "Attribute wasn't found" << endl; + } + else { + attr1 = dynamic_cast(attr); + cout << "Attribute was found " << " HasID " << attr1->HasIntID("eighteen") << " value = " << attr1->GetInt("eighteen")<< endl; + } + + DF_Container *attr2 = (DF_Container*)child.FindAttribute(DF_Container::GetID()); + + if(!attr2) cout << "Can't find the attribute" << endl; + + cout << "Change find : " << attr2->GetInt("eighteen") << endl; + + + cout << "Forgetting " << child.ForgetAttribute(DF_Container::GetID()) << endl; + if(!child.FindAttribute(DF_Container::GetID())) { + cout << "Attribute wasn't found" << endl; + } + + + child = root1.NewChild(); //0:1:4 + + child.NewChild();//0:1:4:1 + + child.NewChild();//0:1:4:2 + + cout << "Is equal " << (child == child) << endl; + cout << "Is equal " << (child == root1) << endl; + + child = root1.NewChild(); //0:1:5 + + child.NewChild();//0:1:5:1 + root1.NewChild();//0:1:6 + + + DF_ChildIterator CI(root1.Father(), true); + //root1.dump(); + for(; CI.More(); CI.Next()) { + cout << CI.Value().Entry() << endl; + //CI.Value().dump(); + } + + DF_Label L = DF_Label::Label(child, "0:1:4:1"); + cout << "Found Label " << L.Entry() << endl; + + std::string s("012-56"); + + int pos = s.find('-'); + cout << "Fisrt part : " << s.substr(0, pos) << endl; + cout << "Last part : " << s.substr(pos+1, s.size()) << endl; + + vector vs = splitString("/dn20/salome/srn/salome2/", '/'); + for(int i = 0; iMain(); + DF_Label sco = root2.NewChild(); //0:1:1 + DF_Label so1 = sco.FindChild(3, true); //0:1:1:3 + DF_Label so5 = so1.FindChild(5, true); //0:1:1:5 + DF_Label so51 = so5.NewChild(); //0:1:1:5:1 + DF_Label so511 = so51.NewChild(); //0:1:1:5:1:1 + DF_Label so513 = so51.FindChild(3, true); //0:1:1:5:1:3 + DF_Label so5131 = so513.NewChild(); //0:1:1:5:1:3:1 + + + so51.FindChild(2, true); + + + DF_ChildIterator CI2(so5, true); + so5.dump(); + for(; CI2.More(); CI2.Next()) { + cout << " ###### Found child with entry = " << CI2.Value().Entry() << endl; + //CI2.Value().dump(); + } + + delete appli; + + cout << "Test finished " << endl; + return 0; +} + diff --git a/src/DSC/DSC_Basic/ConnectionManager_i.cxx b/src/DSC/DSC_Basic/ConnectionManager_i.cxx index 59f3b2624..6b1e376a6 100644 --- a/src/DSC/DSC_Basic/ConnectionManager_i.cxx +++ b/src/DSC/DSC_Basic/ConnectionManager_i.cxx @@ -93,3 +93,15 @@ throw (Engines::ConnectionManager::BadId) delete infos; ids.erase(id); } + +void +ConnectionManager_i::ShutdownWithExit() +{ + exit( EXIT_SUCCESS ); +} + +CORBA::Long +ConnectionManager_i::getPID() +{ + return (CORBA::Long)getpid(); +} diff --git a/src/DSC/DSC_Basic/ConnectionManager_i.hxx b/src/DSC/DSC_Basic/ConnectionManager_i.hxx index c0459f482..ebdfebf35 100644 --- a/src/DSC/DSC_Basic/ConnectionManager_i.hxx +++ b/src/DSC/DSC_Basic/ConnectionManager_i.hxx @@ -67,6 +67,16 @@ class DSC_BASIC_EXPORT ConnectionManager_i : Engines::DSC::Message message) throw (Engines::ConnectionManager::BadId); + /*! + Shutdown the ConnectionManager process. + */ + void ShutdownWithExit(); + + /*! + Returns the PID of the connection manager + */ + CORBA::Long getPID(); + private : struct connection_infos { diff --git a/src/HDFPersist/HDFascii.cc b/src/HDFPersist/HDFascii.cc index 1408f71be..5e1cf18a8 100644 --- a/src/HDFPersist/HDFascii.cc +++ b/src/HDFPersist/HDFascii.cc @@ -26,20 +26,11 @@ #include "HDFOI.hxx" -//#include -//#include -//#include -//#include -//#include - #include #include #include #include -#include -#include -#include -#include +#include #ifdef WNT #include @@ -48,6 +39,8 @@ using namespace std; +void Move(const string& fName, const string& fNameDst); +bool Exists(const string thePath); bool CreateAttributeFromASCII(HDFinternalObject *father, FILE* fp); bool CreateDatasetFromASCII(HDFcontainerObject *father, FILE *fp); bool CreateGroupFromASCII(HDFcontainerObject *father, FILE *fp); @@ -56,14 +49,11 @@ 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(); +string 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); -bool directoryExists(const char* dir); -bool createDirectory(const char* dir); -bool is_readable( const std::string & file ); #define MAX_STRING_SIZE 65535 #define MAX_ID_SIZE 20 @@ -111,15 +101,13 @@ char* HDFascii::ConvertFromHDFToASCII(const char* thePath, bool isReplace, const char* theExtension) { - //TCollection_AsciiString aPath((char*)thePath); - std::string aPath((char*)thePath); + string aPath(thePath); if(!isReplace) { if(theExtension == NULL) aPath += ".asc"; else aPath += (char*)theExtension; } - //TCollection_AsciiString aFileName(aPath); - std::string aFileName(aPath); + string aFileName(aPath); if(isReplace) aFileName=aPath+".ascii_tmp"; HDFfile *hdf_file = new HDFfile((char*)thePath); @@ -128,7 +116,6 @@ char* HDFascii::ConvertFromHDFToASCII(const char* thePath, char name[HDF_NAME_MAX_LEN+1]; int nbsons = hdf_file->nInternalObjects(), nbAttr = hdf_file->nAttributes(); - //FILE* fp = fopen(aFileName.ToCString(), "w"); FILE* fp = fopen(aFileName.c_str(), "w"); fprintf(fp, "%s\n", ASCIIHDF_ID); fprintf(fp, "%i\n", nbsons+nbAttr); @@ -141,7 +128,6 @@ char* HDFascii::ConvertFromHDFToASCII(const char* thePath, hdf_attribute = 0; } - //for (Standard_Integer i=0; iInternalObjectIndentify(i,name); if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue; @@ -167,23 +153,14 @@ char* HDFascii::ConvertFromHDFToASCII(const char* thePath, delete hdf_file; if(isReplace) { -// OSD_Path anOSDPath(aFileName); -// OSD_File anOSDFile(anOSDPath); -// if(anOSDFile.Exists()) -// anOSDFile.Move(aPath); -// else -// return NULL; - if(access (aFileName.c_str() , F_OK ) == 0) { - rename(aFileName.c_str(), aPath.c_str()); - } - else + if(Exists(aFileName)) + Move(aFileName, aPath); + else return NULL; } - //int length = strlen(aPath.ToCString()); int length = strlen(aPath.c_str()); char *new_str = new char[ 1+length ]; - //strcpy(new_str , aPath.ToCString()) ; strcpy(new_str , aPath.c_str()) ; return new_str; @@ -198,18 +175,12 @@ void SaveGroupInASCIIfile(HDFgroup *hdf_group, FILE* fp, int ident) { hdf_group->OpenOnDisk(); - //TCollection_AsciiString anIdent(ident, '\t'); - std::ostringstream oss; - oss << ident; - std::string anIdent(oss.str()); 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; @@ -241,7 +212,6 @@ void SaveGroupInASCIIfile(HDFgroup *hdf_group, FILE* fp, int ident) } } - /*fprintf(fp, "%s%s\n", anIdent.ToCString(), GROUP_ID_END);*/ fprintf(fp, "%s\n", GROUP_ID_END); hdf_group->CloseOnDisk(); @@ -262,38 +232,22 @@ void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident) hdf_byte_order order = hdf_dataset->GetOrder(); int nbAttr = hdf_dataset->nAttributes(); -// TCollection_AsciiString anIdent(ident, '\t'); -// TCollection_AsciiString anIdentChild(ident+1, '\t'); - std::ostringstream oss; - std::ostringstream oss2; - oss << ident; - oss2 << ident+1; - std::string anIdent(oss.str()); - std::string anIdentChild(oss2.str()); - 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) { @@ -351,7 +305,6 @@ void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident) hdf_attribute = 0; } - /*fprintf(fp, "%s%s\n", anIdent.ToCString(), DATASET_ID_END); */ fprintf(fp, "%s\n", DATASET_ID_END); hdf_dataset->CloseOnDisk(); @@ -368,21 +321,10 @@ void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident) hdf_type type = hdf_attribute->GetType(); - //TCollection_AsciiString anIdent(ident, '\t'); - //TCollection_AsciiString anIdentChild(ident+1, '\t'); - std::ostringstream oss; - std::ostringstream oss2; - oss << ident; - oss2 << ident+1; - std::string anIdent(oss.str()); - std::string anIdentChild(oss2.str()); - 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; @@ -390,7 +332,6 @@ void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident) 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"); @@ -398,22 +339,18 @@ void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident) } 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(); @@ -430,15 +367,11 @@ void SaveAttributeInASCIIfile(HDFattribute *hdf_attribute, FILE* fp, int ident) char* HDFascii::ConvertFromASCIIToHDF(const char* thePath) { // Get a temporary directory to store a file - //TCollection_AsciiString aTmpDir = GetTmpDir(), aFileName("hdf_from_ascii.hdf"); - std::string aTmpDir = GetTmpDir(); - std::string aFileName("hdf_from_ascii.hdf"); + string aTmpDir = GetTmpDir(), aFileName("hdf_from_ascii.hdf"); // Build a full file name of temporary file - //TCollection_AsciiString aFullName = aTmpDir + aFileName; - std::string aFullName = aTmpDir + aFileName; + string aFullName = aTmpDir + aFileName; - //HDFfile *hdf_file = new HDFfile(aFullName.ToCString()); - HDFfile *hdf_file = new HDFfile((char *) aFullName.c_str()); + HDFfile *hdf_file = new HDFfile((char*)aFullName.c_str()); hdf_file->CreateOnDisk(); FILE *fp = fopen(thePath, "r"); @@ -487,16 +420,10 @@ char* HDFascii::ConvertFromASCIIToHDF(const char* thePath) hdf_file->CloseOnDisk(); delete hdf_file; - //int length = strlen(aTmpDir.ToCString()); int length = strlen(aTmpDir.c_str()); - cerr << "length : " << length << endl; char *new_str = new char[ 1+length ]; - //strcpy(new_str , aTmpDir.ToCString()) ; strcpy(new_str , aTmpDir.c_str()) ; - cerr << "test ::: " << aTmpDir << endl; - cerr << "test ::: " << new_str << endl; - return new_str; } @@ -716,118 +643,91 @@ bool CreateAttributeFromASCII(HDFinternalObject *father, FILE* fp) // function : GetTempDir // purpose : Return a temp directory to store created files like "/tmp/sub_dir/" //============================================================================ -char* GetTmpDir() +string GetTmpDir() { - //Find a temporary directory to store a file - //TCollection_AsciiString aTmpDir; - std::string aTmpDir; + //Find a temporary directory to store a file -#ifdef WNT - char *aTmp; - aTmp = getenv("TMP"); - if(aTmp != NULL) { -// aTmpDir = TCollection_AsciiString(aTmp); - aTmpDir = std::string(aTmp); + string aTmpDir; + + char *Tmp_dir = getenv("SALOME_TMP_DIR"); + if(Tmp_dir != NULL) { + aTmpDir = string(Tmp_dir); +#ifdef WIN32 + if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; +#else + if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; +#endif } else { -// aTmpDir = TCollection_AsciiString("C:\\"); - aTmpDir = std::string("C:\\"); - } +#ifdef WIN32 + aTmpDir = string("C:\\"); #else - //aTmpDir = TCollection_AsciiString("/tmp/"); - aTmpDir = std::string("/tmp/"); + aTmpDir = string("/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"); - std::ostringstream oss; - oss << aRND; - std::string aSubDir(oss.str()); - if(aSubDir.length() <= 1) aSubDir = std::string("123409876"); + char buffer[127]; + sprintf(buffer, "%d", aRND); + string aSubDir(buffer); + if(aSubDir.size() <= 1) aSubDir = string("123409876"); aTmpDir += aSubDir; //Get RND sub directory #ifdef WIN32 -// if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; - if(aTmpDir[aTmpDir.length()-1] != '\\') aTmpDir+='\\'; + if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; #else -// if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; - if(aTmpDir[aTmpDir.length()-1] != '/') aTmpDir+='/'; + if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; #endif -// OSD_Path aPath(aTmpDir); -// OSD_Directory aDir(aPath); - std::string aDir(aTmpDir); - - //std::cerr << "temp dir .... : " << aTmpDir << std::endl; - - for(aRND = 0; directoryExists(aDir.c_str()); aRND++) { - //aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name - aTmpDir.insert((aTmpDir.length() - 1), oss.str()); //Build a unique directory name - std::cerr << "Tempory directory exist, changing name ..." << std::endl; - std::cerr << "temp dir .... : " << aTmpDir << std::endl; - aDir = std::string(aTmpDir); -// aPath = OSD_Path(aTmpDir); -// aDir = OSD_Directory(aPath); + string aDir = aTmpDir; + + for(aRND = 0; Exists(aDir); aRND++) { + sprintf(buffer, "%d", aRND); + aDir = aTmpDir+buffer; //Build a unique directory name } - //OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX); - //aDir.Build(aProtection); - createDirectory(aDir.c_str()); - //int length = strlen(aTmpDir.ToCString()); - int length = strlen(aTmpDir.c_str()); - char *new_str = new char[ 1+length ]; - //strcpy(new_str , aTmpDir.ToCString()); - strcpy(new_str , aTmpDir.c_str()); - return new_str; +#ifdef WNT + CreateDirectory(aDir.c_str(), NULL); +#else + mkdir(aDir.c_str(), 0x1ff); +#endif + + return aDir; } char* makeName(char* name) { - //TCollection_AsciiString aName(name), aNewName; - std::string aName(name), aNewName; - //Standard_Integer i, length = aName.Length(); - int i, length = aName.length(); + string aName(name), aNewName; + int i, length = aName.size(); char replace = (char)19; - for(i=1; i<=length; i++) { - //if(aName.Value(i) == ' ') aNewName+=replace; - //else aNewName += aName.Value(i); + for(i=0; i dirList; #ifdef WNT @@ -147,14 +150,15 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: dirList = splitStringToList(_general_path, SEPARATOR); } else { //support old format - dirList =splitStringToList(_general_path, OLD_SEPARATOR); - } + dirList = splitStringToList(_general_path, OLD_SEPARATOR); + } #endif - - for(list::iterator iter=dirList.begin();iter!=dirList.end();iter++){ + + for (list::iterator iter = dirList.begin(); iter != dirList.end(); iter++) + { string aPath = (*iter); //remove inverted commas from filename - while(aPath.find('\"') != string::npos) + while (aPath.find('\"') != string::npos) aPath.erase(aPath.find('\"'), 1); _parse_xml_file(aPath.c_str(), @@ -163,17 +167,17 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: _typeMap, _typeList); } - + // Verification of _general_path_list content - if(!_verify_path_prefix(_general_path_list)){ + 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{ + } else { if(MYDEBUG) MESSAGE("General path list OK"); } - - if(_personal_path != NULL){ + + if (_personal_path != NULL) { // Initialize the _personal_module_list and // _personal_path_list members with the personal catalog files _parse_xml_file(_personal_path, @@ -627,6 +631,16 @@ SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name) return NULL; } +CORBA::Long SALOME_ModuleCatalogImpl::getPID() +{ + return (CORBA::Long)getpid(); +} + +void SALOME_ModuleCatalogImpl::ShutdownWithExit() +{ + exit( EXIT_SUCCESS ); +} + ParserComponent * SALOME_ModuleCatalogImpl::findComponent(const string & name) { diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx index 05f0ad7d4..fc4d269fe 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx @@ -110,6 +110,8 @@ public: GetComponentInfo(const char *name); void ping(){}; + CORBA::Long getPID(); + void ShutdownWithExit(); void shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }; diff --git a/src/Registry/RegistryService.cxx b/src/Registry/RegistryService.cxx index 16c0b736c..52a3d1e9a 100644 --- a/src/Registry/RegistryService.cxx +++ b/src/Registry/RegistryService.cxx @@ -265,3 +265,8 @@ void RegistryService::ping() MESSAGE(" RegistryService::ping() pid "<< _getpid()); #endif } + +CORBA::Long RegistryService::getPID() +{ + return (CORBA::Long)getpid(); +} diff --git a/src/Registry/RegistryService.hxx b/src/Registry/RegistryService.hxx index 4315f9321..9b26f41f8 100644 --- a/src/Registry/RegistryService.hxx +++ b/src/Registry/RegistryService.hxx @@ -72,6 +72,7 @@ public : virtual ~RegistryService(void); void ping(); + CORBA::Long getPID(); virtual CORBA::ULong add (const Registry::Infos & infos); virtual CORBA::ULong size ( void ); #ifndef WNT diff --git a/src/Registry/SALOME_Registry_Server.cxx b/src/Registry/SALOME_Registry_Server.cxx index 470cde401..50e608f31 100644 --- a/src/Registry/SALOME_Registry_Server.cxx +++ b/src/Registry/SALOME_Registry_Server.cxx @@ -187,15 +187,15 @@ int main( int argc , char **argv ) } string absoluteName = string("/") + registryName; naming.Register( varComponents , absoluteName.c_str() ) ; - MESSAGE("On attend les requetes des clients") ; + MESSAGE("Wait client requests") ; try { // Activation du POA - MESSAGE("Activation du POA") ; + MESSAGE("POA activation") ; manager->activate() ; // Lancement de l'ORB - MESSAGE("Lancement de l'ORB") ; + MESSAGE("ORB launching") ; #ifdef CHECKTIME Utils_Timer timer; timer.Start(); @@ -207,7 +207,7 @@ int main( int argc , char **argv ) } catch( const CORBA::Exception &ex ) { - MESSAGE("Erreur systeme") ; + MESSAGE("System error") ; return EXIT_FAILURE ; } diff --git a/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx b/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx deleted file mode 100644 index ef5ec178e..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx +++ /dev/null @@ -1,80 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#define _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString); - -class Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) : public Handle(TCollection_MapNode) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)():Handle(TCollection_MapNode)() {} - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)(const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)(const SALOMEDS_DataMapNodeOfDataMapOfIntegerString* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& operator=(const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& operator=(const SALOMEDS_DataMapNodeOfDataMapOfIntegerString* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_DataMapNodeOfDataMapOfIntegerString* operator->() - { - return (SALOMEDS_DataMapNodeOfDataMapOfIntegerString *)ControlAccess(); - } - - SALOMEDS_DataMapNodeOfDataMapOfIntegerString* operator->() const - { - return (SALOMEDS_DataMapNodeOfDataMapOfIntegerString *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)(); - - Standard_EXPORT static const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx b/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx deleted file mode 100644 index e2325adc8..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#define _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TCollection_MapNode_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TCollection_MapNode); -class SALOMEDS_DataMapNodeOfDataMapStringLabel; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel); - -class Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) : public Handle(TCollection_MapNode) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)():Handle(TCollection_MapNode)() {} - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)(const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& aHandle) : Handle(TCollection_MapNode)(aHandle) - { - } - - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)(const SALOMEDS_DataMapNodeOfDataMapStringLabel* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) - { - } - - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& operator=(const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& operator=(const SALOMEDS_DataMapNodeOfDataMapStringLabel* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_DataMapNodeOfDataMapStringLabel* operator->() - { - return (SALOMEDS_DataMapNodeOfDataMapStringLabel *)ControlAccess(); - } - - SALOMEDS_DataMapNodeOfDataMapStringLabel* operator->() const - { - return (SALOMEDS_DataMapNodeOfDataMapStringLabel *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)(); - - Standard_EXPORT static const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_DrawableAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_DrawableAttribute.hxx deleted file mode 100644 index 0a0cf4efe..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_DrawableAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_DrawableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_DrawableAttribute_HeaderFile -#define _Handle_SALOMEDS_DrawableAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_DrawableAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_DrawableAttribute); - -class Handle(SALOMEDS_DrawableAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_DrawableAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_DrawableAttribute)(const Handle(SALOMEDS_DrawableAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_DrawableAttribute)(const SALOMEDS_DrawableAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_DrawableAttribute)& operator=(const Handle(SALOMEDS_DrawableAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_DrawableAttribute)& operator=(const SALOMEDS_DrawableAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_DrawableAttribute* operator->() - { - return (SALOMEDS_DrawableAttribute *)ControlAccess(); - } - - SALOMEDS_DrawableAttribute* operator->() const - { - return (SALOMEDS_DrawableAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_DrawableAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_DrawableAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_ExpandableAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_ExpandableAttribute.hxx deleted file mode 100644 index db9bc2183..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_ExpandableAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_ExpandableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_ExpandableAttribute_HeaderFile -#define _Handle_SALOMEDS_ExpandableAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_ExpandableAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_ExpandableAttribute); - -class Handle(SALOMEDS_ExpandableAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_ExpandableAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_ExpandableAttribute)(const Handle(SALOMEDS_ExpandableAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_ExpandableAttribute)(const SALOMEDS_ExpandableAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_ExpandableAttribute)& operator=(const Handle(SALOMEDS_ExpandableAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_ExpandableAttribute)& operator=(const SALOMEDS_ExpandableAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_ExpandableAttribute* operator->() - { - return (SALOMEDS_ExpandableAttribute *)ControlAccess(); - } - - SALOMEDS_ExpandableAttribute* operator->() const - { - return (SALOMEDS_ExpandableAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_ExpandableAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_ExpandableAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx b/src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx deleted file mode 100644 index 5fd18ab85..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx +++ /dev/null @@ -1,86 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef _Handle_SALOMEDS_ExternalFileDef_HeaderFile -#define _Handle_SALOMEDS_ExternalFileDef_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Comment_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Comment); -class SALOMEDS_ExternalFileDef; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_ExternalFileDef); - -class Handle(SALOMEDS_ExternalFileDef) : public Handle(TDataStd_Comment) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(SALOMEDS_ExternalFileDef)():Handle(TDataStd_Comment)() {} - Handle(SALOMEDS_ExternalFileDef)(const Handle(SALOMEDS_ExternalFileDef)& aHandle) : Handle(TDataStd_Comment)(aHandle) - { - } - - Handle(SALOMEDS_ExternalFileDef)(const SALOMEDS_ExternalFileDef* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) - { - } - - Handle(SALOMEDS_ExternalFileDef)& operator=(const Handle(SALOMEDS_ExternalFileDef)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_ExternalFileDef)& operator=(const SALOMEDS_ExternalFileDef* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_ExternalFileDef* operator->() - { - return (SALOMEDS_ExternalFileDef *)ControlAccess(); - } - - SALOMEDS_ExternalFileDef* operator->() const - { - return (SALOMEDS_ExternalFileDef *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_ExternalFileDef)(); - - Standard_EXPORT static const Handle(SALOMEDS_ExternalFileDef) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_FileType.hxx b/src/SALOMEDS/Handle_SALOMEDS_FileType.hxx deleted file mode 100644 index 17de5bebb..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_FileType.hxx +++ /dev/null @@ -1,87 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef _Handle_SALOMEDS_FileType_HeaderFile -#define _Handle_SALOMEDS_FileType_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Comment_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Comment); -class SALOMEDS_FileType; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_FileType); - -class Handle(SALOMEDS_FileType) : public Handle(TDataStd_Comment) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(SALOMEDS_FileType)():Handle(TDataStd_Comment)() {} - Handle(SALOMEDS_FileType)(const Handle(SALOMEDS_FileType)& aHandle) : Handle(TDataStd_Comment)(aHandle) - { - } - - Handle(SALOMEDS_FileType)(const SALOMEDS_FileType* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) - { - } - - Handle(SALOMEDS_FileType)& operator=(const Handle(SALOMEDS_FileType)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_FileType)& operator=(const SALOMEDS_FileType* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_FileType* operator->() - { - return (SALOMEDS_FileType *)ControlAccess(); - } - - SALOMEDS_FileType* operator->() const - { - return (SALOMEDS_FileType *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_FileType)(); - - Standard_EXPORT static const Handle(SALOMEDS_FileType) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_IORAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_IORAttribute.hxx deleted file mode 100644 index c4c369d1b..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_IORAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_IORAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_IORAttribute_HeaderFile -#define _Handle_SALOMEDS_IORAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Comment_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Comment); -class SALOMEDS_IORAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_IORAttribute); - -class Handle(SALOMEDS_IORAttribute) : public Handle(TDataStd_Comment) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_IORAttribute)():Handle(TDataStd_Comment)() {} - Handle(SALOMEDS_IORAttribute)(const Handle(SALOMEDS_IORAttribute)& aHandle) : Handle(TDataStd_Comment)(aHandle) - { - } - - Handle(SALOMEDS_IORAttribute)(const SALOMEDS_IORAttribute* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) - { - } - - Handle(SALOMEDS_IORAttribute)& operator=(const Handle(SALOMEDS_IORAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_IORAttribute)& operator=(const SALOMEDS_IORAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_IORAttribute* operator->() - { - return (SALOMEDS_IORAttribute *)ControlAccess(); - } - - SALOMEDS_IORAttribute* operator->() const - { - return (SALOMEDS_IORAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_IORAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_IORAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_LocalIDAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_LocalIDAttribute.hxx deleted file mode 100644 index 94205ab0a..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_LocalIDAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_LocalIDAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_LocalIDAttribute_HeaderFile -#define _Handle_SALOMEDS_LocalIDAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_LocalIDAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_LocalIDAttribute); - -class Handle(SALOMEDS_LocalIDAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_LocalIDAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_LocalIDAttribute)(const Handle(SALOMEDS_LocalIDAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_LocalIDAttribute)(const SALOMEDS_LocalIDAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_LocalIDAttribute)& operator=(const Handle(SALOMEDS_LocalIDAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_LocalIDAttribute)& operator=(const SALOMEDS_LocalIDAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_LocalIDAttribute* operator->() - { - return (SALOMEDS_LocalIDAttribute *)ControlAccess(); - } - - SALOMEDS_LocalIDAttribute* operator->() const - { - return (SALOMEDS_LocalIDAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_LocalIDAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_LocalIDAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_OCAFApplication.hxx b/src/SALOMEDS/Handle_SALOMEDS_OCAFApplication.hxx deleted file mode 100644 index ca0fe557a..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_OCAFApplication.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_OCAFApplication.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_OCAFApplication_HeaderFile -#define _Handle_SALOMEDS_OCAFApplication_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDocStd_Application_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDocStd_Application); -class SALOMEDS_OCAFApplication; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_OCAFApplication); - -class Handle(SALOMEDS_OCAFApplication) : public Handle(TDocStd_Application) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_OCAFApplication)():Handle(TDocStd_Application)() {} - Handle(SALOMEDS_OCAFApplication)(const Handle(SALOMEDS_OCAFApplication)& aHandle) : Handle(TDocStd_Application)(aHandle) - { - } - - Handle(SALOMEDS_OCAFApplication)(const SALOMEDS_OCAFApplication* anItem) : Handle(TDocStd_Application)((TDocStd_Application *)anItem) - { - } - - Handle(SALOMEDS_OCAFApplication)& operator=(const Handle(SALOMEDS_OCAFApplication)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_OCAFApplication)& operator=(const SALOMEDS_OCAFApplication* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_OCAFApplication* operator->() - { - return (SALOMEDS_OCAFApplication *)ControlAccess(); - } - - SALOMEDS_OCAFApplication* operator->() const - { - return (SALOMEDS_OCAFApplication *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_OCAFApplication)(); - - Standard_EXPORT static const Handle(SALOMEDS_OCAFApplication) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_OpenedAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_OpenedAttribute.hxx deleted file mode 100644 index 772557566..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_OpenedAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_OpenedAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_OpenedAttribute_HeaderFile -#define _Handle_SALOMEDS_OpenedAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_OpenedAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_OpenedAttribute); - -class Handle(SALOMEDS_OpenedAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_OpenedAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_OpenedAttribute)(const Handle(SALOMEDS_OpenedAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_OpenedAttribute)(const SALOMEDS_OpenedAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_OpenedAttribute)& operator=(const Handle(SALOMEDS_OpenedAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_OpenedAttribute)& operator=(const SALOMEDS_OpenedAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_OpenedAttribute* operator->() - { - return (SALOMEDS_OpenedAttribute *)ControlAccess(); - } - - SALOMEDS_OpenedAttribute* operator->() const - { - return (SALOMEDS_OpenedAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_OpenedAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_OpenedAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_PersRefAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_PersRefAttribute.hxx deleted file mode 100644 index 464943cec..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_PersRefAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_PersRefAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_PersRefAttribute_HeaderFile -#define _Handle_SALOMEDS_PersRefAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Comment_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Comment); -class SALOMEDS_PersRefAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_PersRefAttribute); - -class Handle(SALOMEDS_PersRefAttribute) : public Handle(TDataStd_Comment) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_PersRefAttribute)():Handle(TDataStd_Comment)() {} - Handle(SALOMEDS_PersRefAttribute)(const Handle(SALOMEDS_PersRefAttribute)& aHandle) : Handle(TDataStd_Comment)(aHandle) - { - } - - Handle(SALOMEDS_PersRefAttribute)(const SALOMEDS_PersRefAttribute* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) - { - } - - Handle(SALOMEDS_PersRefAttribute)& operator=(const Handle(SALOMEDS_PersRefAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_PersRefAttribute)& operator=(const SALOMEDS_PersRefAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_PersRefAttribute* operator->() - { - return (SALOMEDS_PersRefAttribute *)ControlAccess(); - } - - SALOMEDS_PersRefAttribute* operator->() const - { - return (SALOMEDS_PersRefAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_PersRefAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_PersRefAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_PixMapAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_PixMapAttribute.hxx deleted file mode 100644 index 842a76425..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_PixMapAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_PixMapAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_PixMapAttribute_HeaderFile -#define _Handle_SALOMEDS_PixMapAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Comment_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Comment); -class SALOMEDS_PixMapAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_PixMapAttribute); - -class Handle(SALOMEDS_PixMapAttribute) : public Handle(TDataStd_Comment) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_PixMapAttribute)():Handle(TDataStd_Comment)() {} - Handle(SALOMEDS_PixMapAttribute)(const Handle(SALOMEDS_PixMapAttribute)& aHandle) : Handle(TDataStd_Comment)(aHandle) - { - } - - Handle(SALOMEDS_PixMapAttribute)(const SALOMEDS_PixMapAttribute* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) - { - } - - Handle(SALOMEDS_PixMapAttribute)& operator=(const Handle(SALOMEDS_PixMapAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_PixMapAttribute)& operator=(const SALOMEDS_PixMapAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_PixMapAttribute* operator->() - { - return (SALOMEDS_PixMapAttribute *)ControlAccess(); - } - - SALOMEDS_PixMapAttribute* operator->() const - { - return (SALOMEDS_PixMapAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_PixMapAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_PixMapAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_PythonObjectAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_PythonObjectAttribute.hxx deleted file mode 100644 index 266d3e483..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_PythonObjectAttribute.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_PythonObjectAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_PythonObjectAttribute_HeaderFile -#define _Handle_SALOMEDS_PythonObjectAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_PythonObjectAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_PythonObjectAttribute); - -class Handle(SALOMEDS_PythonObjectAttribute) : public Handle(TDF_Attribute) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_PythonObjectAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_PythonObjectAttribute)(const Handle(SALOMEDS_PythonObjectAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_PythonObjectAttribute)(const SALOMEDS_PythonObjectAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_PythonObjectAttribute)& operator=(const Handle(SALOMEDS_PythonObjectAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_PythonObjectAttribute)& operator=(const SALOMEDS_PythonObjectAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_PythonObjectAttribute* operator->() - { - return (SALOMEDS_PythonObjectAttribute *)ControlAccess(); - } - - SALOMEDS_PythonObjectAttribute* operator->() const - { - return (SALOMEDS_PythonObjectAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_PythonObjectAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_PythonObjectAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_SelectableAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_SelectableAttribute.hxx deleted file mode 100644 index e1972c4ab..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_SelectableAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_SelectableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_SelectableAttribute_HeaderFile -#define _Handle_SALOMEDS_SelectableAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_SelectableAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_SelectableAttribute); - -class Handle(SALOMEDS_SelectableAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_SelectableAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_SelectableAttribute)(const Handle(SALOMEDS_SelectableAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_SelectableAttribute)(const SALOMEDS_SelectableAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_SelectableAttribute)& operator=(const Handle(SALOMEDS_SelectableAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_SelectableAttribute)& operator=(const SALOMEDS_SelectableAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_SelectableAttribute* operator->() - { - return (SALOMEDS_SelectableAttribute *)ControlAccess(); - } - - SALOMEDS_SelectableAttribute* operator->() const - { - return (SALOMEDS_SelectableAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_SelectableAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_SelectableAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx deleted file mode 100644 index 1db1747bf..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#define _Handle_SALOMEDS_SequenceOfIntegerAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_SequenceOfIntegerAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute); - -class Handle(SALOMEDS_SequenceOfIntegerAttribute) : public Handle(TDF_Attribute) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(SALOMEDS_SequenceOfIntegerAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_SequenceOfIntegerAttribute)(const Handle(SALOMEDS_SequenceOfIntegerAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_SequenceOfIntegerAttribute)(const SALOMEDS_SequenceOfIntegerAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_SequenceOfIntegerAttribute)& operator=(const Handle(SALOMEDS_SequenceOfIntegerAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_SequenceOfIntegerAttribute)& operator=(const SALOMEDS_SequenceOfIntegerAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_SequenceOfIntegerAttribute* operator->() - { - return (SALOMEDS_SequenceOfIntegerAttribute *)ControlAccess(); - } - - SALOMEDS_SequenceOfIntegerAttribute* operator->() const - { - return (SALOMEDS_SequenceOfIntegerAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_SequenceOfIntegerAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_SequenceOfIntegerAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_SequenceOfRealAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_SequenceOfRealAttribute.hxx deleted file mode 100644 index b9a9d4913..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_SequenceOfRealAttribute.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_SequenceOfRealAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_SequenceOfRealAttribute_HeaderFile -#define _Handle_SALOMEDS_SequenceOfRealAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_SequenceOfRealAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute); - -class Handle(SALOMEDS_SequenceOfRealAttribute) : public Handle(TDF_Attribute) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(SALOMEDS_SequenceOfRealAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_SequenceOfRealAttribute)(const Handle(SALOMEDS_SequenceOfRealAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_SequenceOfRealAttribute)(const SALOMEDS_SequenceOfRealAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_SequenceOfRealAttribute)& operator=(const Handle(SALOMEDS_SequenceOfRealAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_SequenceOfRealAttribute)& operator=(const SALOMEDS_SequenceOfRealAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_SequenceOfRealAttribute* operator->() - { - return (SALOMEDS_SequenceOfRealAttribute *)ControlAccess(); - } - - SALOMEDS_SequenceOfRealAttribute* operator->() const - { - return (SALOMEDS_SequenceOfRealAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_SequenceOfRealAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_SequenceOfRealAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_StudyPropertiesAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_StudyPropertiesAttribute.hxx deleted file mode 100644 index 14b12dd51..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_StudyPropertiesAttribute.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_StudyPropertiesAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_StudyPropertiesAttribute_HeaderFile -#define _Handle_SALOMEDS_StudyPropertiesAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_StudyPropertiesAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute); - -class Handle(SALOMEDS_StudyPropertiesAttribute) : public Handle(TDF_Attribute) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_StudyPropertiesAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_StudyPropertiesAttribute)(const Handle(SALOMEDS_StudyPropertiesAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_StudyPropertiesAttribute)(const SALOMEDS_StudyPropertiesAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_StudyPropertiesAttribute)& operator=(const Handle(SALOMEDS_StudyPropertiesAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_StudyPropertiesAttribute)& operator=(const SALOMEDS_StudyPropertiesAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_StudyPropertiesAttribute* operator->() - { - return (SALOMEDS_StudyPropertiesAttribute *)ControlAccess(); - } - - SALOMEDS_StudyPropertiesAttribute* operator->() const - { - return (SALOMEDS_StudyPropertiesAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_StudyPropertiesAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_StudyPropertiesAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TableOfIntegerAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TableOfIntegerAttribute.hxx deleted file mode 100644 index 25986ce60..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TableOfIntegerAttribute.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_TableOfIntegerAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_TableOfIntegerAttribute_HeaderFile -#define _Handle_SALOMEDS_TableOfIntegerAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_TableOfIntegerAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute); - -class Handle(SALOMEDS_TableOfIntegerAttribute) : public Handle(TDF_Attribute) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TableOfIntegerAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_TableOfIntegerAttribute)(const Handle(SALOMEDS_TableOfIntegerAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_TableOfIntegerAttribute)(const SALOMEDS_TableOfIntegerAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_TableOfIntegerAttribute)& operator=(const Handle(SALOMEDS_TableOfIntegerAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TableOfIntegerAttribute)& operator=(const SALOMEDS_TableOfIntegerAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TableOfIntegerAttribute* operator->() - { - return (SALOMEDS_TableOfIntegerAttribute *)ControlAccess(); - } - - SALOMEDS_TableOfIntegerAttribute* operator->() const - { - return (SALOMEDS_TableOfIntegerAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TableOfIntegerAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TableOfIntegerAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TableOfRealAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TableOfRealAttribute.hxx deleted file mode 100644 index 000e8cf11..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TableOfRealAttribute.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_TableOfRealAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_TableOfRealAttribute_HeaderFile -#define _Handle_SALOMEDS_TableOfRealAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_TableOfRealAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TableOfRealAttribute); - -class Handle(SALOMEDS_TableOfRealAttribute) : public Handle(TDF_Attribute) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TableOfRealAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_TableOfRealAttribute)(const Handle(SALOMEDS_TableOfRealAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_TableOfRealAttribute)(const SALOMEDS_TableOfRealAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_TableOfRealAttribute)& operator=(const Handle(SALOMEDS_TableOfRealAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TableOfRealAttribute)& operator=(const SALOMEDS_TableOfRealAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TableOfRealAttribute* operator->() - { - return (SALOMEDS_TableOfRealAttribute *)ControlAccess(); - } - - SALOMEDS_TableOfRealAttribute* operator->() const - { - return (SALOMEDS_TableOfRealAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TableOfRealAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TableOfRealAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TableOfStringAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TableOfStringAttribute.hxx deleted file mode 100644 index 0125b9447..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TableOfStringAttribute.hxx +++ /dev/null @@ -1,84 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : Handle_SALOMEDS_TableOfStringAttribute.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _Handle_SALOMEDS_TableOfStringAttribute_HeaderFile -#define _Handle_SALOMEDS_TableOfStringAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDF_Attribute); -class SALOMEDS_TableOfStringAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TableOfStringAttribute); - -class Handle(SALOMEDS_TableOfStringAttribute) : public Handle(TDF_Attribute) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TableOfStringAttribute)():Handle(TDF_Attribute)() {} - Handle(SALOMEDS_TableOfStringAttribute)(const Handle(SALOMEDS_TableOfStringAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle) - { - } - - Handle(SALOMEDS_TableOfStringAttribute)(const SALOMEDS_TableOfStringAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem) - { - } - - Handle(SALOMEDS_TableOfStringAttribute)& operator=(const Handle(SALOMEDS_TableOfStringAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TableOfStringAttribute)& operator=(const SALOMEDS_TableOfStringAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TableOfStringAttribute* operator->() - { - return (SALOMEDS_TableOfStringAttribute *)ControlAccess(); - } - - SALOMEDS_TableOfStringAttribute* operator->() const - { - return (SALOMEDS_TableOfStringAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TableOfStringAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TableOfStringAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TargetAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TargetAttribute.hxx deleted file mode 100644 index 68b6bbdda..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TargetAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_TargetAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_TargetAttribute_HeaderFile -#define _Handle_SALOMEDS_TargetAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_Integer_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_Integer); -class SALOMEDS_TargetAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TargetAttribute); - -class Handle(SALOMEDS_TargetAttribute) : public Handle(TDataStd_Integer) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TargetAttribute)():Handle(TDataStd_Integer)() {} - Handle(SALOMEDS_TargetAttribute)(const Handle(SALOMEDS_TargetAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle) - { - } - - Handle(SALOMEDS_TargetAttribute)(const SALOMEDS_TargetAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem) - { - } - - Handle(SALOMEDS_TargetAttribute)& operator=(const Handle(SALOMEDS_TargetAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TargetAttribute)& operator=(const SALOMEDS_TargetAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TargetAttribute* operator->() - { - return (SALOMEDS_TargetAttribute *)ControlAccess(); - } - - SALOMEDS_TargetAttribute* operator->() const - { - return (SALOMEDS_TargetAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TargetAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TargetAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TextColorAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TextColorAttribute.hxx deleted file mode 100644 index a16b6bc72..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TextColorAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_TextColorAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_TextColorAttribute_HeaderFile -#define _Handle_SALOMEDS_TextColorAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_RealArray_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_RealArray); -class SALOMEDS_TextColorAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TextColorAttribute); - -class Handle(SALOMEDS_TextColorAttribute) : public Handle(TDataStd_RealArray) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TextColorAttribute)():Handle(TDataStd_RealArray)() {} - Handle(SALOMEDS_TextColorAttribute)(const Handle(SALOMEDS_TextColorAttribute)& aHandle) : Handle(TDataStd_RealArray)(aHandle) - { - } - - Handle(SALOMEDS_TextColorAttribute)(const SALOMEDS_TextColorAttribute* anItem) : Handle(TDataStd_RealArray)((TDataStd_RealArray *)anItem) - { - } - - Handle(SALOMEDS_TextColorAttribute)& operator=(const Handle(SALOMEDS_TextColorAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TextColorAttribute)& operator=(const SALOMEDS_TextColorAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TextColorAttribute* operator->() - { - return (SALOMEDS_TextColorAttribute *)ControlAccess(); - } - - SALOMEDS_TextColorAttribute* operator->() const - { - return (SALOMEDS_TextColorAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TextColorAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TextColorAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_TextHighlightColorAttribute.hxx b/src/SALOMEDS/Handle_SALOMEDS_TextHighlightColorAttribute.hxx deleted file mode 100644 index d1a6d4649..000000000 --- a/src/SALOMEDS/Handle_SALOMEDS_TextHighlightColorAttribute.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_TextHighlightColorAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Handle_SALOMEDS_TextHighlightColorAttribute_HeaderFile -#define _Handle_SALOMEDS_TextHighlightColorAttribute_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_TDataStd_RealArray_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TDataStd_RealArray); -class SALOMEDS_TextHighlightColorAttribute; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute); - -class Handle(SALOMEDS_TextHighlightColorAttribute) : public Handle(TDataStd_RealArray) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - Handle(SALOMEDS_TextHighlightColorAttribute)():Handle(TDataStd_RealArray)() {} - Handle(SALOMEDS_TextHighlightColorAttribute)(const Handle(SALOMEDS_TextHighlightColorAttribute)& aHandle) : Handle(TDataStd_RealArray)(aHandle) - { - } - - Handle(SALOMEDS_TextHighlightColorAttribute)(const SALOMEDS_TextHighlightColorAttribute* anItem) : Handle(TDataStd_RealArray)((TDataStd_RealArray *)anItem) - { - } - - Handle(SALOMEDS_TextHighlightColorAttribute)& operator=(const Handle(SALOMEDS_TextHighlightColorAttribute)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(SALOMEDS_TextHighlightColorAttribute)& operator=(const SALOMEDS_TextHighlightColorAttribute* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - SALOMEDS_TextHighlightColorAttribute* operator->() - { - return (SALOMEDS_TextHighlightColorAttribute *)ControlAccess(); - } - - SALOMEDS_TextHighlightColorAttribute* operator->() const - { - return (SALOMEDS_TextHighlightColorAttribute *)ControlAccess(); - } - - Standard_EXPORT ~Handle(SALOMEDS_TextHighlightColorAttribute)(); - - Standard_EXPORT static const Handle(SALOMEDS_TextHighlightColorAttribute) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index 1cf369df1..0d9bac30a 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -55,13 +55,13 @@ dist_salomescript_DATA = SALOME_DriverPy.py # This local variable defines the list of CPPFLAGS common to all target in this package. COMMON_CPPFLAGS=\ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ @BOOST_CPPFLAGS@ \ -I$(srcdir)/../HDFPersist \ @HDF5_INCLUDES@ \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ + -I$(srcdir)/../DF \ -I$(srcdir)/../SALOMEDSImpl \ -I$(srcdir)/../NamingService \ -I$(srcdir)/../GenericObj \ @@ -82,11 +82,11 @@ COMMON_LIBS =\ ../SALOMELocalTrace/libSALOMELocalTrace.la \ ../Basics/libSALOMEBasics.la \ ../HDFPersist/libSalomeHDFPersist.la \ + ../DF/libDF.la \ ../SALOMEDSImpl/libSalomeDSImpl.la \ ../GenericObj/libSalomeGenericObj.la \ ../LifeCycleCORBA/libSalomeLifeCycleCORBA.la \ $(top_builddir)/idl/libSalomeIDLKernel.la\ - @CAS_KERNEL@ \ @HDF5_LIBS@ \ $(LDXMUFLAGS) @@ -184,30 +184,6 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_AttributeParameter.cxx \ SALOMEDS_AttributeString.cxx \ SALOMEDS_IParameters.cxx \ - \ - Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx \ - Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx \ - Handle_SALOMEDS_DrawableAttribute.hxx \ - Handle_SALOMEDS_ExpandableAttribute.hxx \ - Handle_SALOMEDS_ExternalFileDef.hxx \ - Handle_SALOMEDS_FileType.hxx \ - Handle_SALOMEDS_IORAttribute.hxx \ - Handle_SALOMEDS_LocalIDAttribute.hxx \ - Handle_SALOMEDS_OCAFApplication.hxx \ - Handle_SALOMEDS_OpenedAttribute.hxx \ - Handle_SALOMEDS_PersRefAttribute.hxx \ - Handle_SALOMEDS_PixMapAttribute.hxx \ - Handle_SALOMEDS_PythonObjectAttribute.hxx \ - Handle_SALOMEDS_SelectableAttribute.hxx \ - Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx \ - Handle_SALOMEDS_SequenceOfRealAttribute.hxx \ - Handle_SALOMEDS_StudyPropertiesAttribute.hxx \ - Handle_SALOMEDS_TableOfIntegerAttribute.hxx \ - Handle_SALOMEDS_TableOfRealAttribute.hxx \ - Handle_SALOMEDS_TableOfStringAttribute.hxx \ - Handle_SALOMEDS_TargetAttribute.hxx \ - Handle_SALOMEDS_TextColorAttribute.hxx \ - Handle_SALOMEDS_TextHighlightColorAttribute.hxx \ SALOMEDS_AttLong_i.hxx \ SALOMEDS_AttReal_i.hxx \ SALOMEDS_AttributeComment.hxx \ @@ -273,37 +249,14 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_ChildIterator.hxx \ SALOMEDS_ChildIterator_i.hxx \ SALOMEDS_ClientAttributes.hxx \ - SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx \ - SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx \ - SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx \ - SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx \ - SALOMEDS_DataMapOfIntegerString.hxx \ - SALOMEDS_DataMapStringLabel.hxx \ - SALOMEDS_DrawableAttribute.hxx \ SALOMEDS_Driver_i.hxx \ - SALOMEDS_ExpandableAttribute.hxx \ - SALOMEDS_ExternalFileDef.hxx \ - SALOMEDS_FileType.hxx \ - SALOMEDS_FlagsAttribute.hxx \ SALOMEDS_GenericAttribute.hxx \ SALOMEDS_GenericAttribute_i.hxx \ - SALOMEDS_GraphicAttribute.hxx \ SALOMEDS.hxx \ - SALOMEDS_IORAttribute.hxx \ - SALOMEDS_LocalIDAttribute.hxx \ - SALOMEDS_OCAFApplication.hxx \ - SALOMEDS_OpenedAttribute.hxx \ - SALOMEDS_PersRefAttribute.hxx \ - SALOMEDS_PixMapAttribute.hxx \ - SALOMEDS_PythonObjectAttribute.hxx \ - SALOMEDS_SAttribute_i.hxx \ SALOMEDS_SComponent.hxx \ SALOMEDS_SComponent_i.hxx \ SALOMEDS_SComponentIterator.hxx \ SALOMEDS_SComponentIterator_i.hxx \ - SALOMEDS_SelectableAttribute.hxx \ - SALOMEDS_SequenceOfIntegerAttribute.hxx \ - SALOMEDS_SequenceOfRealAttribute.hxx \ SALOMEDS_SObject.hxx \ SALOMEDS_SObject_i.hxx \ SALOMEDS_StudyBuilder.hxx \ @@ -312,13 +265,6 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_Study_i.hxx \ SALOMEDS_StudyManager.hxx \ SALOMEDS_StudyManager_i.hxx \ - SALOMEDS_StudyPropertiesAttribute.hxx \ - SALOMEDS_TableOfIntegerAttribute.hxx \ - SALOMEDS_TableOfRealAttribute.hxx \ - SALOMEDS_TableOfStringAttribute.hxx \ - SALOMEDS_TargetAttribute.hxx \ - SALOMEDS_TextColorAttribute.hxx \ - SALOMEDS_TextHighlightColorAttribute.hxx \ SALOMEDS_UseCaseBuilder.hxx \ SALOMEDS_UseCaseBuilder_i.hxx \ SALOMEDS_UseCaseIterator.hxx \ diff --git a/src/SALOMEDS/SALOMEDS.cdl b/src/SALOMEDS/SALOMEDS.cdl deleted file mode 100644 index 4e256f88b..000000000 --- a/src/SALOMEDS/SALOMEDS.cdl +++ /dev/null @@ -1,59 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS.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; diff --git a/src/SALOMEDS/SALOMEDS_AttLong_i.cxx b/src/SALOMEDS/SALOMEDS_AttLong_i.cxx index e4fed9600..b126fe493 100644 --- a/src/SALOMEDS/SALOMEDS_AttLong_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttLong_i.cxx @@ -28,8 +28,8 @@ #include "SALOMEDS_AttLong_i.hxx" #include "utilities.h" -#include #include +#include using namespace std; //============================================================================ @@ -40,7 +40,7 @@ using namespace std; void SALOMEDS_AttLong_i::Set(CORBA::Long i) { CheckLocked(); - TDataStd_Integer::Set (_Lab,i); + SALOMEDSImpl_AttributeInteger::Set (_Lab,i); } //============================================================================ @@ -50,9 +50,9 @@ void SALOMEDS_AttLong_i::Set(CORBA::Long i) //============================================================================ CORBA::Long SALOMEDS_AttLong_i::Get() { - Handle(TDataStd_Integer) Att; + SALOMEDSImpl_AttributeInteger* Att = NULL; CORBA::Long x; - if (_Lab.FindAttribute(TDataStd_Integer::GetID(),Att)) + if ((Att=(SALOMEDSImpl_AttributeInteger*)_Lab.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) x = Att->Get (); return x; } @@ -88,8 +88,7 @@ void SALOMEDS_AttLong_i::Load() //============================================================================ CORBA::Boolean SALOMEDS_AttLong_i::GetPtr(SALOMEDS::SObject_ptr anObject) { - Handle(TDataStd_Integer) Att; - return _Lab.FindAttribute(TDataStd_Integer::GetID(),Att); + return (_Lab.IsAttribute(SALOMEDSImpl_AttributeInteger::GetID())); } //============================================================================ diff --git a/src/SALOMEDS/SALOMEDS_AttLong_i.hxx b/src/SALOMEDS/SALOMEDS_AttLong_i.hxx index c0654deae..adb6acb0c 100644 --- a/src/SALOMEDS/SALOMEDS_AttLong_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttLong_i.hxx @@ -30,7 +30,6 @@ #define __SALOMEDS_ATTLONG_I_H__ // IDL headers -#include #include #include CORBA_SERVER_HEADER(SALOMEDS_AttLong) #include "SALOMEDS_BasicAttribute_i.hxx" diff --git a/src/SALOMEDS/SALOMEDS_AttReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttReal_i.cxx index ab3e6795a..30740a810 100644 --- a/src/SALOMEDS/SALOMEDS_AttReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttReal_i.cxx @@ -28,9 +28,9 @@ #include "SALOMEDS_AttReal_i.hxx" #include "utilities.h" -#include #include #include +#include using namespace std; //============================================================================ @@ -41,7 +41,7 @@ using namespace std; void SALOMEDS_AttReal_i::Set(CORBA::Double r) { CheckLocked(); - TDataStd_Real::Set (_Lab,r); + SALOMEDSImpl_AttributeReal::Set (_Lab,r); } //============================================================================ @@ -51,9 +51,9 @@ void SALOMEDS_AttReal_i::Set(CORBA::Double r) //============================================================================ CORBA::Double SALOMEDS_AttReal_i::Get() { - Handle(TDataStd_Real) Att; + SALOMEDSImpl_AttributeReal* Att; CORBA::Double x; - if (_Lab.FindAttribute(TDataStd_Real::GetID(),Att)) + if ((Att=(SALOMEDSImpl_AttributeReal*)_Lab.FindAttribute(TDataStd_Real::GetID()))) x = Att->Get (); return x; } @@ -89,8 +89,7 @@ void SALOMEDS_AttReal_i::Load() //============================================================================ CORBA::Boolean SALOMEDS_AttReal_i::GetPtr(SALOMEDS::SObject_ptr anObject) { - Handle(TDataStd_Real) Att; - return _Lab.FindAttribute(TDataStd_Real::GetID(),Att); + return _Lab.IsAttribute(SALOMEDSImpl_AttributeReal::GetID()); } //============================================================================ diff --git a/src/SALOMEDS/SALOMEDS_AttReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttReal_i.hxx index e03a26942..65fda690a 100644 --- a/src/SALOMEDS/SALOMEDS_AttReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttReal_i.hxx @@ -30,7 +30,6 @@ #define __SALOMEDS_ATTREAL_I_H__ // IDL headers -#include #include #include CORBA_SERVER_HEADER(SALOMEDS_AttReal) #include "SALOMEDS_BasicAttribute_i.hxx" diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment.cxx b/src/SALOMEDS/SALOMEDS_AttributeComment.cxx index 84dfa5945..7bb139c31 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributeComment::SALOMEDS_AttributeComment(const Handle(SALOMEDSImpl_AttributeComment)& theAttr) +SALOMEDS_AttributeComment::SALOMEDS_AttributeComment(SALOMEDSImpl_AttributeComment* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributeComment::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeComment::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributeComment::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeComment)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeComment::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment.hxx b/src/SALOMEDS/SALOMEDS_AttributeComment.hxx index 978982444..117e87c02 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeComment: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeComment { public: - SALOMEDS_AttributeComment(const Handle(SALOMEDSImpl_AttributeComment)& theAttr); + SALOMEDS_AttributeComment(SALOMEDSImpl_AttributeComment* theAttr); SALOMEDS_AttributeComment(SALOMEDS::AttributeComment_ptr theAttr); ~SALOMEDS_AttributeComment(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx index bdc1d86e2..a7901b036 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeComment_i.hxx" -#include #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDS.hxx" @@ -35,7 +34,7 @@ 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()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -44,6 +43,7 @@ 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)); + CORBA::String_var Str = CORBA::string_dup(value); + string aValue((char*)Str.in()); + dynamic_cast(_impl)->SetValue(aValue); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx index e97589cce..f5c780706 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeComment_i.hxx @@ -35,7 +35,7 @@ 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_AttributeComment_i(SALOMEDSImpl_AttributeComment* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; virtual ~SALOMEDS_AttributeComment_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx index 8f4ed701a..2c3c716e1 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeDrawable.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeDrawable::SALOMEDS_AttributeDrawable(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr) +SALOMEDS_AttributeDrawable::SALOMEDS_AttributeDrawable(SALOMEDSImpl_AttributeDrawable* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +40,7 @@ bool SALOMEDS_AttributeDrawable::IsDrawable() bool aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->IsDrawable(); + aValue = (bool)dynamic_cast(_local_impl)->IsDrawable(); } else aValue = SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->IsDrawable(); return aValue; @@ -54,7 +51,7 @@ void SALOMEDS_AttributeDrawable::SetDrawable(bool value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->SetDrawable((int)value); + dynamic_cast(_local_impl)->SetDrawable((int)value); } else SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->SetDrawable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx index 9236c4aa7..5e5a0cdee 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeDrawable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeDrawable { public: - SALOMEDS_AttributeDrawable(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr); + SALOMEDS_AttributeDrawable(SALOMEDSImpl_AttributeDrawable* theAttr); SALOMEDS_AttributeDrawable(SALOMEDS::AttributeDrawable_ptr theAttr); ~SALOMEDS_AttributeDrawable(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx index 1fecbad88..babf93efa 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.cxx @@ -31,12 +31,12 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeDrawable_i::IsDrawable() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->IsDrawable() == 1); + return (dynamic_cast(_impl)->IsDrawable() == 1); } void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->SetDrawable(value); + dynamic_cast(_impl)->SetDrawable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx index f023c9e1b..f8a4bb386 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeDrawable_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeDrawable_i: public virtual POA_SALOMEDS::AttributeDrawab { public: - SALOMEDS_AttributeDrawable_i(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeDrawable_i(SALOMEDSImpl_AttributeDrawable* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; virtual ~SALOMEDS_AttributeDrawable_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx index 49ec9e140..399c81bd0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable.cxx @@ -24,11 +24,7 @@ #include "SALOMEDS_AttributeExpandable.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable - (const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr) +SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable(SALOMEDSImpl_AttributeExpandable* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,7 +40,7 @@ bool SALOMEDS_AttributeExpandable::IsExpandable() bool aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->IsExpandable(); + aValue = (bool)dynamic_cast(_local_impl)->IsExpandable(); } else aValue = SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->IsExpandable(); return aValue; @@ -55,7 +51,7 @@ void SALOMEDS_AttributeExpandable::SetExpandable(bool value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->SetExpandable((int)value); + dynamic_cast(_local_impl)->SetExpandable((int)value); } else SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->SetExpandable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx index 68ebe8fd1..364d8dcb3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeExpandable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeExpandable { public: - SALOMEDS_AttributeExpandable(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr); + SALOMEDS_AttributeExpandable(SALOMEDSImpl_AttributeExpandable* theAttr); SALOMEDS_AttributeExpandable(SALOMEDS::AttributeExpandable_ptr theAttr); ~SALOMEDS_AttributeExpandable(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx index 87a9694dd..a9ee7e17b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.cxx @@ -30,12 +30,12 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeExpandable_i::IsExpandable() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->IsExpandable() == 1); + return (dynamic_cast(_impl)->IsExpandable() == 1); } void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->SetExpandable(value); + dynamic_cast(_impl)->SetExpandable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx index 160257fc3..477301ad0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExpandable_i.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeExpandable_i: public virtual POA_SALOMEDS::AttributeExpa { public: - SALOMEDS_AttributeExpandable_i(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeExpandable_i(SALOMEDSImpl_AttributeExpandable* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeExpandable_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx index e2bc4f33e..f3b382914 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.cxx @@ -23,12 +23,9 @@ #include "SALOMEDS_AttributeExternalFileDef.hxx" #include "SALOMEDS.hxx" - #include -#include -#include -SALOMEDS_AttributeExternalFileDef::SALOMEDS_AttributeExternalFileDef(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr) +SALOMEDS_AttributeExternalFileDef::SALOMEDS_AttributeExternalFileDef(SALOMEDSImpl_AttributeExternalFileDef* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +41,7 @@ std::string SALOMEDS_AttributeExternalFileDef::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +52,7 @@ void SALOMEDS_AttributeExternalFileDef::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx index 4c85cbd7c..f1bc56cde 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeExternalFileDef: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeExternalFileDef { public: - SALOMEDS_AttributeExternalFileDef(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr); + SALOMEDS_AttributeExternalFileDef(SALOMEDSImpl_AttributeExternalFileDef* theAttr); SALOMEDS_AttributeExternalFileDef(SALOMEDS::AttributeExternalFileDef_ptr theAttr); ~SALOMEDS_AttributeExternalFileDef(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx index 1d7339b80..8432b3dee 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeExternalFileDef_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; @@ -32,7 +31,7 @@ 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()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -41,5 +40,5 @@ 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)); + dynamic_cast(_impl)->SetValue(string(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx index 861d429f3..753024aa7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeExternalFileDef_i: public virtual POA_SALOMEDS::Attribut { public: - SALOMEDS_AttributeExternalFileDef_i(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeExternalFileDef_i(SALOMEDSImpl_AttributeExternalFileDef* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {} ~SALOMEDS_AttributeExternalFileDef_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx b/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx index 0ae6b9045..065535367 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributeFileType::SALOMEDS_AttributeFileType(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr) +SALOMEDS_AttributeFileType::SALOMEDS_AttributeFileType(SALOMEDSImpl_AttributeFileType* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributeFileType::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeFileType::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributeFileType::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeFileType::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx b/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx index 82db6239e..cbc6a7af6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeFileType: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeFileType { public: - SALOMEDS_AttributeFileType(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr); + SALOMEDS_AttributeFileType(SALOMEDSImpl_AttributeFileType* theAttr); SALOMEDS_AttributeFileType(SALOMEDS::AttributeFileType_ptr theAttr); ~SALOMEDS_AttributeFileType(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx index 3fc7a683d..c445c2d9c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeFileType_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; @@ -32,7 +31,7 @@ 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()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -41,5 +40,6 @@ 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)); + string aValue((char*)Str.in()); + dynamic_cast(_impl)->SetValue(aValue); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx index fac9b0f80..fa864b6b6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeFileType_i: public virtual POA_SALOMEDS::AttributeFileTy public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeFileType_i(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeFileType_i(SALOMEDSImpl_AttributeFileType* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeFileType_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx b/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx index 0367e538e..153134969 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeFlags.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr) +SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(SALOMEDSImpl_AttributeFlags* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +40,7 @@ int SALOMEDS_AttributeFlags::GetFlags() int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Get(); + aValue = dynamic_cast(_local_impl)->Get(); } else aValue = SALOMEDS::AttributeFlags::_narrow(_corba_impl)->GetFlags(); return aValue; @@ -53,7 +50,7 @@ void SALOMEDS_AttributeFlags::SetFlags(int theFlags) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Set(theFlags); + dynamic_cast(_local_impl)->Set(theFlags); } else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->SetFlags(theFlags); } @@ -67,7 +64,7 @@ void SALOMEDS_AttributeFlags::Set(int theFlag, bool theValue) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl); + SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast(_local_impl); if (theValue) anAttr->Set(anAttr->Get() | theFlag); else diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx b/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx index e2a3cfcc6..14cf6f670 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeFlags: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeFlags { public: - SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr); + SALOMEDS_AttributeFlags(SALOMEDSImpl_AttributeFlags* theAttr); SALOMEDS_AttributeFlags(SALOMEDS::AttributeFlags_ptr theAttr); ~SALOMEDS_AttributeFlags(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx index fe41264e5..3852207e6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.cxx @@ -46,7 +46,7 @@ using namespace std; CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get(); + return dynamic_cast(_impl)->Get(); } //======================================================================= @@ -56,7 +56,7 @@ CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags() void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags ) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Set( theFlags ); + dynamic_cast(_impl)->Set( theFlags ); } //======================================================================= @@ -66,7 +66,7 @@ void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags ) CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag ) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get() & theFlag ? true : false; + return dynamic_cast(_impl)->Get() & theFlag ? true : false; } //======================================================================= @@ -76,7 +76,7 @@ CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag ) void SALOMEDS_AttributeFlags_i::Set( CORBA::Long theFlag, CORBA::Boolean theValue ) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl); + SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast(_impl); if ( theValue ) anAttr->Set( anAttr->Get() | theFlag ); else diff --git a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx index 265f1ff4f..20d5e3b9a 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeFlags_i.hxx @@ -49,7 +49,7 @@ class SALOMEDS_AttributeFlags_i: public virtual POA_SALOMEDS::AttributeFlags, { public: - SALOMEDS_AttributeFlags_i( const Handle(SALOMEDSImpl_AttributeFlags)& theAttr, CORBA::ORB_ptr orb ) + SALOMEDS_AttributeFlags_i( SALOMEDSImpl_AttributeFlags* theAttr, CORBA::ORB_ptr orb ) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; virtual ~SALOMEDS_AttributeFlags_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx index 43fc2d7ef..14af9e948 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeGraphic.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeGraphic::SALOMEDS_AttributeGraphic(const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr) +SALOMEDS_AttributeGraphic::SALOMEDS_AttributeGraphic(SALOMEDSImpl_AttributeGraphic* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,7 +41,7 @@ bool SALOMEDS_AttributeGraphic::GetVisibility(int theViewId) bool aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->GetVisibility(theViewId); + aValue = (bool)dynamic_cast(_local_impl)->GetVisibility(theViewId); } else aValue = SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->GetVisibility(theViewId); return aValue; @@ -54,7 +51,7 @@ void SALOMEDS_AttributeGraphic::SetVisibility(int theViewId, bool theValue) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->SetVisibility(theViewId, theValue); + dynamic_cast(_local_impl)->SetVisibility(theViewId, theValue); } else SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->SetVisibility(theViewId, theValue); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx index d5c0888e1..5faff2e96 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeGraphic: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeGraphic { public: - SALOMEDS_AttributeGraphic(const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr); + SALOMEDS_AttributeGraphic(SALOMEDSImpl_AttributeGraphic* theAttr); SALOMEDS_AttributeGraphic(SALOMEDS::AttributeGraphic_ptr theAttr); ~SALOMEDS_AttributeGraphic(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx index 72d1a2d13..bec0d9c21 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.cxx @@ -42,8 +42,8 @@ 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 ); + if ( _impl ) + dynamic_cast(_impl)->SetVisibility( theViewId, theValue ); } //======================================================================= @@ -53,7 +53,7 @@ void SALOMEDS_AttributeGraphic_i::SetVisibility( CORBA::Long theViewId, CORBA::Boolean SALOMEDS_AttributeGraphic_i::GetVisibility( CORBA::Long theViewId ) { SALOMEDS::Locker lock; - return !_impl.IsNull() ? Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_impl)->GetVisibility( theViewId ) : false; + return ( _impl ) ? dynamic_cast(_impl)->GetVisibility( theViewId ) : false; } diff --git a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx index 8a9ec8c7c..ef47d51c2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeGraphic_i.hxx @@ -45,7 +45,7 @@ class SALOMEDS_AttributeGraphic_i: public virtual POA_SALOMEDS::AttributeGraphic { public: - SALOMEDS_AttributeGraphic_i( const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr, CORBA::ORB_ptr orb ) + SALOMEDS_AttributeGraphic_i( SALOMEDSImpl_AttributeGraphic* theAttr, CORBA::ORB_ptr orb ) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; virtual ~SALOMEDS_AttributeGraphic_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx index 348e82436..b41bef603 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributeIOR::SALOMEDS_AttributeIOR(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr) +SALOMEDS_AttributeIOR::SALOMEDS_AttributeIOR(SALOMEDSImpl_AttributeIOR* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributeIOR::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeIOR):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributeIOR::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx b/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx index 9099cd681..da9c54c51 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeIOR: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeIOR { public: - SALOMEDS_AttributeIOR(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr); + SALOMEDS_AttributeIOR(SALOMEDSImpl_AttributeIOR* theAttr); SALOMEDS_AttributeIOR(SALOMEDS::AttributeIOR_ptr theAttr); ~SALOMEDS_AttributeIOR(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx index e1d058fc0..b53fb5684 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeIOR_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; @@ -32,7 +31,7 @@ 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()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -41,6 +40,6 @@ void SALOMEDS_AttributeIOR_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - TCollection_ExtendedString anExtStr((char *)Str.in()); - Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->SetValue(anExtStr); + string anExtStr((char *)Str.in()); + dynamic_cast(_impl)->SetValue(anExtStr); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx index ceba370ea..72deae171 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx @@ -34,7 +34,7 @@ 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_AttributeIOR_i(SALOMEDSImpl_AttributeIOR* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeIOR_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx index 1f5496ac3..481b17ad4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeInteger.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeInteger::SALOMEDS_AttributeInteger(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr) +SALOMEDS_AttributeInteger::SALOMEDS_AttributeInteger(SALOMEDSImpl_AttributeInteger* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -40,12 +37,14 @@ SALOMEDS_AttributeInteger::~SALOMEDS_AttributeInteger() int SALOMEDS_AttributeInteger::Value() { - int aValue; + int aValue = 0; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->Value(); + aValue = dynamic_cast(_local_impl)->Value(); + } + else { + aValue = SALOMEDS::AttributeInteger::_narrow(_corba_impl)->Value(); } - else aValue = SALOMEDS::AttributeInteger::_narrow(_corba_impl)->Value(); return aValue; } @@ -54,7 +53,7 @@ void SALOMEDS_AttributeInteger::SetValue(int value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->SetValue(value); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeInteger::_narrow(_corba_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx b/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx index 03c3cb353..e29b864df 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeInteger { public: - SALOMEDS_AttributeInteger(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr); + SALOMEDS_AttributeInteger(SALOMEDSImpl_AttributeInteger* theAttr); SALOMEDS_AttributeInteger(SALOMEDS::AttributeInteger_ptr theAttr); ~SALOMEDS_AttributeInteger(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx index 6b2025b3a..d8f7d69af 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.cxx @@ -30,14 +30,14 @@ using namespace std; CORBA::Long SALOMEDS_AttributeInteger_i::Value() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->Value(); + return dynamic_cast(_impl)->Value(); } void SALOMEDS_AttributeInteger_i::SetValue(CORBA::Long value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->SetValue(value); + dynamic_cast(_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx index 39b3c20fd..576b4f1dc 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeInteger_i.hxx @@ -37,7 +37,7 @@ 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_AttributeInteger_i(SALOMEDSImpl_AttributeInteger* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeInteger_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx index 9fd941897..dc559ee8d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID.cxx @@ -24,10 +24,8 @@ #include "SALOMEDS_AttributeLocalID.hxx" #include "SALOMEDS.hxx" -#include -#include -SALOMEDS_AttributeLocalID::SALOMEDS_AttributeLocalID(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr) +SALOMEDS_AttributeLocalID::SALOMEDS_AttributeLocalID(SALOMEDSImpl_AttributeLocalID* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +41,7 @@ int SALOMEDS_AttributeLocalID::Value() int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->Value(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->Value(); return aValue; @@ -54,7 +52,7 @@ void SALOMEDS_AttributeLocalID::SetValue(int value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->SetValue(value); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx index 582ac4b08..c695693d5 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeLocalID: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeLocalID { public: - SALOMEDS_AttributeLocalID(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr); + SALOMEDS_AttributeLocalID(SALOMEDSImpl_AttributeLocalID* theAttr); SALOMEDS_AttributeLocalID(SALOMEDS::AttributeLocalID_ptr theAttr); ~SALOMEDS_AttributeLocalID(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx index 45bd9f439..3163addec 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.cxx @@ -30,13 +30,13 @@ using namespace std; CORBA::Long SALOMEDS_AttributeLocalID_i::Value() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_impl)->Value(); + return dynamic_cast(_impl)->Value(); } void SALOMEDS_AttributeLocalID_i::SetValue(CORBA::Long value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_impl)->SetValue(value); + dynamic_cast(_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx index b68b32298..627a448a4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeLocalID_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeLocalID_i: public virtual POA_SALOMEDS::AttributeLocalID { public: - SALOMEDS_AttributeLocalID_i(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeLocalID_i(SALOMEDSImpl_AttributeLocalID* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeLocalID_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeName.cxx b/src/SALOMEDS/SALOMEDS_AttributeName.cxx index 2a8d5ec21..943d549d4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributeName::SALOMEDS_AttributeName(const Handle(SALOMEDSImpl_AttributeName)& theAttr) +SALOMEDS_AttributeName::SALOMEDS_AttributeName(SALOMEDSImpl_AttributeName* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributeName::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributeName::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeName)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeName.hxx b/src/SALOMEDS/SALOMEDS_AttributeName.hxx index 6b159959c..b3a26f92d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeName: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeName { public: - SALOMEDS_AttributeName(const Handle(SALOMEDSImpl_AttributeName)& theAttr); + SALOMEDS_AttributeName(SALOMEDSImpl_AttributeName* theAttr); SALOMEDS_AttributeName(SALOMEDS::AttributeName_ptr theAttr); ~SALOMEDS_AttributeName(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx index 4b5028828..7d534f795 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeName_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; @@ -32,7 +31,7 @@ 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()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -40,5 +39,5 @@ void SALOMEDS_AttributeName_i::SetValue(const char* value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->SetValue(TCollection_ExtendedString((char*)value)); + dynamic_cast(_impl)->SetValue(string(value)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx index 03a0178c3..337f4a43d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeName_i: public virtual POA_SALOMEDS::AttributeName, { public: - SALOMEDS_AttributeName_i(const Handle(SALOMEDSImpl_AttributeName)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeName_i(SALOMEDSImpl_AttributeName* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeName_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx b/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx index 2338147c0..433a0341c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeOpened.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeOpened::SALOMEDS_AttributeOpened(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr) +SALOMEDS_AttributeOpened::SALOMEDS_AttributeOpened(SALOMEDSImpl_AttributeOpened* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +40,7 @@ bool SALOMEDS_AttributeOpened::IsOpened() bool aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->IsOpened(); + aValue = (bool)dynamic_cast(_local_impl)->IsOpened(); } else aValue = SALOMEDS::AttributeOpened::_narrow(_corba_impl)->IsOpened(); return aValue; @@ -53,7 +50,7 @@ void SALOMEDS_AttributeOpened::SetOpened(bool value) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->SetOpened((int)value); + dynamic_cast(_local_impl)->SetOpened((int)value); } else SALOMEDS::AttributeOpened::_narrow(_corba_impl)->SetOpened(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx b/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx index dc3e8ed49..2db9b99bb 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeOpened: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeOpened { public: - SALOMEDS_AttributeOpened(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr); + SALOMEDS_AttributeOpened(SALOMEDSImpl_AttributeOpened* theAttr); SALOMEDS_AttributeOpened(SALOMEDS::AttributeOpened_ptr theAttr); ~SALOMEDS_AttributeOpened(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx index 0ad4b7a60..0aa297d57 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.cxx @@ -30,14 +30,14 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeOpened_i::IsOpened() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->IsOpened() == 1); + return (dynamic_cast(_impl)->IsOpened() == 1); } void SALOMEDS_AttributeOpened_i::SetOpened(CORBA::Boolean value) { SALOMEDS::Locker lock; - Standard_Integer val = 0; + int val = 0; if (value != 0) val = 1; - Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->SetOpened(val); + dynamic_cast(_impl)->SetOpened(val); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx index e5901db7e..dff3f3ac1 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeOpened_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeOpened_i: public virtual POA_SALOMEDS::AttributeOpened, { public: - SALOMEDS_AttributeOpened_i(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeOpened_i(SALOMEDSImpl_AttributeOpened* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeOpened_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx b/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx index dd6c188f3..6f4262aed 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx @@ -25,7 +25,8 @@ #include "SALOMEDS.hxx" #include -#include + +using namespace std; //======================================================================= /*! @@ -33,7 +34,7 @@ * Purpose : Creates a new instance of SALOMEDS_AttributeParameter */ //======================================================================= -SALOMEDS_AttributeParameter::SALOMEDS_AttributeParameter(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr) +SALOMEDS_AttributeParameter::SALOMEDS_AttributeParameter(SALOMEDSImpl_AttributeParameter* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -68,7 +69,7 @@ void SALOMEDS_AttributeParameter::SetInt(const string& theID, const int theValue if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetInt(theID, theValue); + dynamic_cast(_local_impl)->SetInt(theID, theValue); } else SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetInt(theID.c_str(), theValue); @@ -85,7 +86,7 @@ int SALOMEDS_AttributeParameter::GetInt(const string& theID) int aValue; if(_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetInt(theID); + aValue = dynamic_cast(_local_impl)->GetInt(theID); } else aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetInt(theID.c_str()); @@ -104,7 +105,7 @@ void SALOMEDS_AttributeParameter::SetReal(const string& theID, const double& the if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetReal(theID, theValue); + dynamic_cast(_local_impl)->SetReal(theID, theValue); } else SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetReal(theID.c_str(), theValue); @@ -121,7 +122,7 @@ double SALOMEDS_AttributeParameter::GetReal(const string& theID) double aValue; if(_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetReal(theID); + aValue = dynamic_cast(_local_impl)->GetReal(theID); } else aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetReal(theID.c_str()); @@ -140,7 +141,7 @@ void SALOMEDS_AttributeParameter::SetString(const string& theID, const string& t if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetString(theID, theValue); + dynamic_cast(_local_impl)->SetString(theID, theValue); } else SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetString(theID.c_str(), theValue.c_str()); @@ -157,7 +158,7 @@ string SALOMEDS_AttributeParameter::GetString(const string& theID) string aValue; if(_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetString(theID); + aValue = dynamic_cast(_local_impl)->GetString(theID); } else aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetString(theID.c_str()); @@ -176,7 +177,7 @@ void SALOMEDS_AttributeParameter::SetBool(const string& theID, const bool& theVa if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetBool(theID, theValue); + dynamic_cast(_local_impl)->SetBool(theID, theValue); } else SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetBool(theID.c_str(), theValue); @@ -192,7 +193,7 @@ bool SALOMEDS_AttributeParameter::GetBool(const string& theID) { if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetBool(theID); + return dynamic_cast(_local_impl)->GetBool(theID); } else return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetBool(theID.c_str()); @@ -210,7 +211,7 @@ void SALOMEDS_AttributeParameter::SetRealArray(const string& theID, const vector if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetRealArray(theID, theArray); + dynamic_cast(_local_impl)->SetRealArray(theID, theArray); } else { SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq; @@ -234,7 +235,7 @@ vector SALOMEDS_AttributeParameter::GetRealArray(const string& theID) vector v; if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetRealArray(theID); + return dynamic_cast(_local_impl)->GetRealArray(theID); } else { SALOMEDS::DoubleSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetRealArray(theID.c_str()); @@ -259,7 +260,7 @@ void SALOMEDS_AttributeParameter::SetIntArray(const string& theID, const vector< if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetIntArray(theID, theArray); + dynamic_cast(_local_impl)->SetIntArray(theID, theArray); } else { SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq; @@ -283,7 +284,7 @@ vector SALOMEDS_AttributeParameter::GetIntArray(const string& theID) vector v; if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetIntArray(theID); + return dynamic_cast(_local_impl)->GetIntArray(theID); } else { SALOMEDS::LongSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetIntArray(theID.c_str()); @@ -308,7 +309,7 @@ void SALOMEDS_AttributeParameter::SetStrArray(const string& theID, const vector< if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetStrArray(theID, theArray); + dynamic_cast(_local_impl)->SetStrArray(theID, theArray); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq; @@ -332,7 +333,7 @@ vector SALOMEDS_AttributeParameter::GetStrArray(const string& theID) vector v; if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetStrArray(theID); + return dynamic_cast(_local_impl)->GetStrArray(theID); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetStrArray(theID.c_str()); @@ -357,7 +358,7 @@ bool SALOMEDS_AttributeParameter::IsSet(const string& theID, const int theType) { if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->IsSet(theID, (Parameter_Types)theType); + return dynamic_cast(_local_impl)->IsSet(theID, (Parameter_Types)theType); } else return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->IsSet(theID.c_str(), theType); @@ -375,7 +376,7 @@ bool SALOMEDS_AttributeParameter::RemoveID(const string& theID, const int theTyp if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->RemoveID(theID, (Parameter_Types)theType); + return dynamic_cast(_local_impl)->RemoveID(theID, (Parameter_Types)theType); } else return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->RemoveID(theID.c_str(), theType); @@ -392,8 +393,8 @@ _PTR(AttributeParameter) SALOMEDS_AttributeParameter::GetFather() SALOMEDSClient_AttributeParameter* AP = NULL; if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) AP_impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetFather(); - if(AP_impl.IsNull()) return _PTR(AttributeParameter)(AP); + SALOMEDSImpl_AttributeParameter* AP_impl = dynamic_cast(_local_impl)->GetFather(); + if(!AP_impl) return _PTR(AttributeParameter)(AP); AP = new SALOMEDS_AttributeParameter(AP_impl); } else { @@ -415,7 +416,7 @@ bool SALOMEDS_AttributeParameter::HasFather() { if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->HasFather(); + return dynamic_cast(_local_impl)->HasFather(); } else return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->HasFather(); @@ -431,7 +432,7 @@ bool SALOMEDS_AttributeParameter::IsRoot() { if(_isLocal) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->IsRoot(); + return dynamic_cast(_local_impl)->IsRoot(); } else return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->IsRoot(); @@ -447,7 +448,7 @@ void SALOMEDS_AttributeParameter::Clear() { if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->Clear(); + dynamic_cast(_local_impl)->Clear(); } else SALOMEDS::AttributeParameter::_narrow(_corba_impl)->Clear(); @@ -464,7 +465,7 @@ vector SALOMEDS_AttributeParameter::GetIDs(const int theType) vector v; if(_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) AP_impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl); + SALOMEDSImpl_AttributeParameter* AP_impl = dynamic_cast(_local_impl); return AP_impl->GetIDs((Parameter_Types)theType); } else { diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter.hxx b/src/SALOMEDS/SALOMEDS_AttributeParameter.hxx index e2eaca613..065834e60 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeParameter: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeParameter { public: - SALOMEDS_AttributeParameter(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr); + SALOMEDS_AttributeParameter(SALOMEDSImpl_AttributeParameter* theAttr); SALOMEDS_AttributeParameter(SALOMEDS::AttributeParameter_ptr theAttr); ~SALOMEDS_AttributeParameter(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx index e126d44a4..8fd549db3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeParameter_i.hxx" #include "SALOMEDS.hxx" -#include #include @@ -40,7 +39,7 @@ void SALOMEDS_AttributeParameter_i::SetInt(const char* theID, CORBA::Long theVal { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetInt(theID, theValue); + dynamic_cast(_impl)->SetInt(theID, theValue); } //======================================================================= @@ -52,7 +51,7 @@ void SALOMEDS_AttributeParameter_i::SetInt(const char* theID, CORBA::Long theVal CORBA::Long SALOMEDS_AttributeParameter_i::GetInt(const char* theID) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetInt(theID); + return dynamic_cast(_impl)->GetInt(theID); } //======================================================================= @@ -65,7 +64,7 @@ void SALOMEDS_AttributeParameter_i::SetReal(const char* theID, CORBA::Double the { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetReal(theID, theValue); + dynamic_cast(_impl)->SetReal(theID, theValue); } //======================================================================= @@ -77,7 +76,7 @@ void SALOMEDS_AttributeParameter_i::SetReal(const char* theID, CORBA::Double the CORBA::Double SALOMEDS_AttributeParameter_i::GetReal(const char* theID) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetReal(theID); + return dynamic_cast(_impl)->GetReal(theID); } //======================================================================= @@ -90,7 +89,7 @@ void SALOMEDS_AttributeParameter_i::SetString(const char* theID, const char* the { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl); + SALOMEDSImpl_AttributeParameter* impl = dynamic_cast(_impl); impl->SetString(theID, theValue); } @@ -103,7 +102,7 @@ void SALOMEDS_AttributeParameter_i::SetString(const char* theID, const char* the char* SALOMEDS_AttributeParameter_i::GetString(const char* theID) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl); + SALOMEDSImpl_AttributeParameter* impl = dynamic_cast(_impl); CORBA::String_var c_s = CORBA::string_dup(impl->GetString(theID).c_str()); return c_s._retn(); } @@ -118,7 +117,7 @@ void SALOMEDS_AttributeParameter_i::SetBool(const char* theID, CORBA::Boolean th { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetBool(theID, theValue); + dynamic_cast(_impl)->SetBool(theID, theValue); } //======================================================================= @@ -130,7 +129,7 @@ void SALOMEDS_AttributeParameter_i::SetBool(const char* theID, CORBA::Boolean th CORBA::Boolean SALOMEDS_AttributeParameter_i::GetBool(const char* theID) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetBool(theID); + return dynamic_cast(_impl)->GetBool(theID); } //======================================================================= @@ -149,7 +148,7 @@ void SALOMEDS_AttributeParameter_i::SetRealArray(const char* theID, const SALOME v.resize(length); for(int i = 0; iSetRealArray(theID, v); + dynamic_cast(_impl)->SetRealArray(theID, v); } //======================================================================= @@ -162,7 +161,7 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeParameter_i::GetRealArray(const char* the { SALOMEDS::Locker lock; SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq; - vector v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetRealArray(theID); + vector v = dynamic_cast(_impl)->GetRealArray(theID); int length = v.size(); if(length) { aSeq->length(length); @@ -187,7 +186,7 @@ void SALOMEDS_AttributeParameter_i::SetIntArray(const char* theID, const SALOMED v.resize(length); for(int i = 0; iSetIntArray(theID, v); + dynamic_cast(_impl)->SetIntArray(theID, v); } //======================================================================= @@ -200,7 +199,7 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeParameter_i::GetIntArray(const char* theID) { SALOMEDS::Locker lock; SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq; - vector v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetIntArray(theID); + vector v = dynamic_cast(_impl)->GetIntArray(theID); int length = v.size(); if(length) { aSeq->length(length); @@ -225,7 +224,7 @@ void SALOMEDS_AttributeParameter_i::SetStrArray(const char* theID, const SALOMED v.resize(length); for(int i = 0; iSetStrArray(theID, v); + dynamic_cast(_impl)->SetStrArray(theID, v); } //======================================================================= @@ -238,7 +237,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetStrArray(const char* theI { SALOMEDS::Locker lock; SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq; - vector v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetStrArray(theID); + vector v = dynamic_cast(_impl)->GetStrArray(theID); int length = v.size(); if(length) { aSeq->length(length); @@ -258,7 +257,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetStrArray(const char* theI CORBA::Boolean SALOMEDS_AttributeParameter_i::IsSet(const char* theID, CORBA::Long theType) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->IsSet(theID, (Parameter_Types)theType); + return dynamic_cast(_impl)->IsSet(theID, (Parameter_Types)theType); } //======================================================================= @@ -271,7 +270,7 @@ CORBA::Boolean SALOMEDS_AttributeParameter_i::RemoveID(const char* theID, CORBA: { SALOMEDS::Locker lock; CheckLocked(); - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->RemoveID(theID, (Parameter_Types)theType); + return dynamic_cast(_impl)->RemoveID(theID, (Parameter_Types)theType); } //======================================================================= @@ -283,7 +282,7 @@ CORBA::Boolean SALOMEDS_AttributeParameter_i::RemoveID(const char* theID, CORBA: SALOMEDS::AttributeParameter_ptr SALOMEDS_AttributeParameter_i::GetFather() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl); + SALOMEDSImpl_AttributeParameter* impl = dynamic_cast(_impl); SALOMEDS_AttributeParameter_i* attr = new SALOMEDS_AttributeParameter_i(impl, _orb); return attr->AttributeParameter::_this(); } @@ -297,7 +296,7 @@ SALOMEDS::AttributeParameter_ptr SALOMEDS_AttributeParameter_i::GetFather() CORBA::Boolean SALOMEDS_AttributeParameter_i::HasFather() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->HasFather(); + return dynamic_cast(_impl)->HasFather(); } //======================================================================= @@ -309,7 +308,7 @@ CORBA::Boolean SALOMEDS_AttributeParameter_i::HasFather() CORBA::Boolean SALOMEDS_AttributeParameter_i::IsRoot() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->IsRoot(); + return dynamic_cast(_impl)->IsRoot(); } //======================================================================= @@ -321,7 +320,7 @@ CORBA::Boolean SALOMEDS_AttributeParameter_i::IsRoot() void SALOMEDS_AttributeParameter_i::Clear() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->Clear(); + dynamic_cast(_impl)->Clear(); } @@ -335,7 +334,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetIDs(CORBA::Long theType) { SALOMEDS::Locker lock; SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq; - vector A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetIDs((Parameter_Types)theType); + vector A = dynamic_cast(_impl)->GetIDs((Parameter_Types)theType); if(A.size()) { int length = A.size(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx index 9cff082f2..4cd8304e4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx @@ -42,7 +42,7 @@ class SALOMEDS_AttributeParameter_i: public virtual POA_SALOMEDS::AttributeParam { public: - SALOMEDS_AttributeParameter_i(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeParameter_i(SALOMEDSImpl_AttributeParameter* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeParameter_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx index a4458ab79..da23c57e4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributePersistentRef::SALOMEDS_AttributePersistentRef(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr) +SALOMEDS_AttributePersistentRef::SALOMEDS_AttributePersistentRef(SALOMEDSImpl_AttributePersistentRef* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributePersistentRef::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributePersistentRef::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx index a66387744..730994352 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributePersistentRef: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePersistentRef { public: - SALOMEDS_AttributePersistentRef(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr); + SALOMEDS_AttributePersistentRef(SALOMEDSImpl_AttributePersistentRef* theAttr); SALOMEDS_AttributePersistentRef(SALOMEDS::AttributePersistentRef_ptr theAttr); ~SALOMEDS_AttributePersistentRef(); diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx index 13e1dd996..3b2994c75 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributePersistentRef_i.hxx" #include "SALOMEDS.hxx" -#include using namespace std; @@ -32,7 +31,7 @@ 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()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -41,5 +40,5 @@ 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)); + dynamic_cast(_impl)->SetValue(string(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx index 9d1244613..c5fa98e91 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePersistentRef_i.hxx @@ -34,7 +34,7 @@ class SALOMEDS_AttributePersistentRef_i: public virtual POA_SALOMEDS::AttributeP public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributePersistentRef_i(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributePersistentRef_i(SALOMEDSImpl_AttributePersistentRef* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributePersistentRef_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx index 66561401d..752e2e482 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributePixMap::SALOMEDS_AttributePixMap(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr) +SALOMEDS_AttributePixMap::SALOMEDS_AttributePixMap(SALOMEDSImpl_AttributePixMap* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,7 +42,7 @@ bool SALOMEDS_AttributePixMap::HasPixMap() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->HasPixMap(); + ret = dynamic_cast(_local_impl)->HasPixMap(); } else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap(); return ret; @@ -55,8 +53,7 @@ std::string SALOMEDS_AttributePixMap::GetPixMap() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap):: - DownCast(_local_impl)->GetPixMap()).ToCString(); + aValue = dynamic_cast(_local_impl)->GetPixMap(); } else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap(); return aValue; @@ -67,7 +64,7 @@ void SALOMEDS_AttributePixMap::SetPixMap(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->SetPixMap((char*)value.c_str()); + dynamic_cast(_local_impl)->SetPixMap(value); } else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx b/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx index e81a4b764..44092f92f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributePixMap: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePixMap { public: - SALOMEDS_AttributePixMap(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr); + SALOMEDS_AttributePixMap(SALOMEDSImpl_AttributePixMap* theAttr); SALOMEDS_AttributePixMap(SALOMEDS::AttributePixMap_ptr theAttr); ~SALOMEDS_AttributePixMap(); diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx index 96cc1ea4e..d532e90f7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.cxx @@ -25,22 +25,19 @@ #include "SALOMEDS_AttributePixMap_i.hxx" #include "SALOMEDS.hxx" -#include - using namespace std; CORBA::Boolean SALOMEDS_AttributePixMap_i::HasPixMap() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->HasPixMap(); + return dynamic_cast(_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()); + CORBA::string_dup(dynamic_cast(_impl)->GetPixMap().c_str()); return S._retn(); } @@ -49,5 +46,5 @@ 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)); + dynamic_cast(_impl)->SetPixMap(string(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx index edf03f799..7ace31b1b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributePixMap_i: public virtual POA_SALOMEDS::AttributePixMap, { public: - SALOMEDS_AttributePixMap_i(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributePixMap_i(SALOMEDSImpl_AttributePixMap* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributePixMap_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx index cb97c18fb..ce3e9607b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr) +SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(SALOMEDSImpl_AttributePythonObject* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,7 +42,7 @@ bool SALOMEDS_AttributePythonObject::IsScript() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->IsScript(); + ret = dynamic_cast(_local_impl)->IsScript(); } else ret = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->IsScript(); return ret; @@ -55,8 +53,7 @@ std::string SALOMEDS_AttributePythonObject::GetObject() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePythonObject):: - DownCast(_local_impl)->GetObject()).ToCString(); + aValue = dynamic_cast(_local_impl)->GetObject().c_str(); } else aValue = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->GetObject(); return aValue; @@ -67,8 +64,7 @@ void SALOMEDS_AttributePythonObject::SetObject(const std::string& theSequence, b if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributePythonObject):: - DownCast(_local_impl)->SetObject((char*)theSequence.c_str(), IsScript); + dynamic_cast(_local_impl)->SetObject(theSequence, IsScript); } else SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->SetObject(theSequence.c_str(), IsScript); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx index e26235ca7..24f07d42c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributePythonObject: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePythonObject { public: - SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr); + SALOMEDS_AttributePythonObject(SALOMEDSImpl_AttributePythonObject* theAttr); SALOMEDS_AttributePythonObject(SALOMEDS::AttributePythonObject_ptr theAttr); ~SALOMEDS_AttributePythonObject(); diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx index 316eb9142..77234207f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx @@ -24,8 +24,6 @@ #include "SALOMEDS_AttributePythonObject_i.hxx" #include "SALOMEDS.hxx" -#include -#include using namespace std; @@ -34,22 +32,21 @@ void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA: SALOMEDS::Locker lock; CheckLocked(); char *aSeq = CORBA::string_dup(theSequence); - Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->SetObject(aSeq, IsScript); + dynamic_cast(_impl)->SetObject(aSeq, IsScript); } char* SALOMEDS_AttributePythonObject_i::GetObject() { SALOMEDS::Locker lock; - TCollection_AsciiString aSeq(Handle(SALOMEDSImpl_AttributePythonObject):: - DownCast(_impl)->GetObject().ToCString()); - CORBA::String_var aStr = CORBA::string_dup(aSeq.ToCString()); + string aSeq(dynamic_cast(_impl)->GetObject()); + CORBA::String_var aStr = CORBA::string_dup(aSeq.c_str()); return aStr._retn(); } CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->IsScript(); + return dynamic_cast(_impl)->IsScript(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx index d5629488d..8ee76137e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributePythonObject_i: public virtual POA_SALOMEDS::AttributePy public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributePythonObject_i(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributePythonObject_i(SALOMEDSImpl_AttributePythonObject* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributePythonObject_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeReal.cxx index c61481837..6d37fdfd7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeReal.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeReal::SALOMEDS_AttributeReal(const Handle(SALOMEDSImpl_AttributeReal)& theAttr) +SALOMEDS_AttributeReal::SALOMEDS_AttributeReal(SALOMEDSImpl_AttributeReal* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +40,7 @@ double SALOMEDS_AttributeReal::Value() double aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->Value(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeReal::_narrow(_corba_impl)->Value(); return aValue; @@ -54,7 +51,7 @@ void SALOMEDS_AttributeReal::SetValue(double value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->SetValue(value); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeReal::_narrow(_corba_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal.hxx b/src/SALOMEDS/SALOMEDS_AttributeReal.hxx index d579571c3..063d954d3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeReal { public: - SALOMEDS_AttributeReal(const Handle(SALOMEDSImpl_AttributeReal)& theAttr); + SALOMEDS_AttributeReal(SALOMEDSImpl_AttributeReal* theAttr); SALOMEDS_AttributeReal(SALOMEDS::AttributeReal_ptr theAttr); ~SALOMEDS_AttributeReal(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx index 3016d83ef..92614b9b0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal_i.cxx @@ -31,13 +31,13 @@ using namespace std; CORBA::Double SALOMEDS_AttributeReal_i::Value() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->Value(); + return dynamic_cast(_impl)->Value(); } void SALOMEDS_AttributeReal_i::SetValue(CORBA::Double value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->SetValue(value); + dynamic_cast(_impl)->SetValue(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx index 76a1b906d..b564219c8 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeReal_i.hxx @@ -35,7 +35,7 @@ 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_AttributeReal_i(SALOMEDSImpl_AttributeReal* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeReal_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx index 872f25d00..4ba2407e0 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable.cxx @@ -24,10 +24,7 @@ #include "SALOMEDS_AttributeSelectable.hxx" #include "SALOMEDS.hxx" -#include -#include - -SALOMEDS_AttributeSelectable::SALOMEDS_AttributeSelectable(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr) +SALOMEDS_AttributeSelectable::SALOMEDS_AttributeSelectable(SALOMEDSImpl_AttributeSelectable* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -43,7 +40,7 @@ bool SALOMEDS_AttributeSelectable::IsSelectable() bool aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = (bool)Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->IsSelectable(); + aValue = (bool)dynamic_cast(_local_impl)->IsSelectable(); } else aValue = SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->IsSelectable(); return aValue; @@ -53,7 +50,7 @@ void SALOMEDS_AttributeSelectable::SetSelectable(bool value) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->SetSelectable((int)value); + dynamic_cast(_local_impl)->SetSelectable((int)value); } else SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->SetSelectable(value); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx index 4cb716f25..41c642308 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeSelectable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSelectable { public: - SALOMEDS_AttributeSelectable(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr); + SALOMEDS_AttributeSelectable(SALOMEDSImpl_AttributeSelectable* theAttr); SALOMEDS_AttributeSelectable(SALOMEDS::AttributeSelectable_ptr theAttr); ~SALOMEDS_AttributeSelectable(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx index b296ac785..038f23c8e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.cxx @@ -30,14 +30,14 @@ using namespace std; CORBA::Boolean SALOMEDS_AttributeSelectable_i::IsSelectable() { SALOMEDS::Locker lock; - return (Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->IsSelectable() == 1); + return (dynamic_cast(_impl)->IsSelectable() == 1); } void SALOMEDS_AttributeSelectable_i::SetSelectable(CORBA::Boolean value) { SALOMEDS::Locker lock; - Standard_Integer val = 0; + int val = 0; if (value != 0) val = 1; - Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->SetSelectable(val); + dynamic_cast(_impl)->SetSelectable(val); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx index 6d10fbad3..8fe3c51f5 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSelectable_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeSelectable_i: public virtual POA_SALOMEDS::AttributeSele public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeSelectable_i(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeSelectable_i(SALOMEDSImpl_AttributeSelectable* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeSelectable_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx index 16cc47d2b..3b06809a5 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.cxx @@ -24,12 +24,8 @@ #include "SALOMEDS_AttributeSequenceOfInteger.hxx" #include "SALOMEDS.hxx" -#include -#include -#include - SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger - (const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr) + (SALOMEDSImpl_AttributeSequenceOfInteger* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -47,9 +43,7 @@ void SALOMEDS_AttributeSequenceOfInteger::Assign(const std::vector& other) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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); + dynamic_cast(_local_impl)->Assign(other); } else { SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq(); @@ -65,8 +59,8 @@ std::vector SALOMEDS_AttributeSequenceOfInteger::CorbaSequence() int i, aLength; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfInteger) aSeqAttr; - aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl); + SALOMEDSImpl_AttributeSequenceOfInteger* aSeqAttr; + aSeqAttr = dynamic_cast(_local_impl); aLength = aSeqAttr->Length(); for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i)); } @@ -84,7 +78,7 @@ void SALOMEDS_AttributeSequenceOfInteger::Add(int value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Add(value); + dynamic_cast(_local_impl)->Add(value); } else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Add(value); } @@ -94,7 +88,7 @@ void SALOMEDS_AttributeSequenceOfInteger::Remove(int index) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Remove(index); + dynamic_cast(_local_impl)->Remove(index); } else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Remove(index); } @@ -104,7 +98,7 @@ void SALOMEDS_AttributeSequenceOfInteger::ChangeValue(int index, int value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->ChangeValue(index, value); + dynamic_cast(_local_impl)->ChangeValue(index, value); } else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->ChangeValue(index, value); } @@ -114,7 +108,7 @@ int SALOMEDS_AttributeSequenceOfInteger::Value(int index) int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Value(index); + aValue = dynamic_cast(_local_impl)->Value(index); } else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Value(index); return aValue; @@ -125,7 +119,7 @@ int SALOMEDS_AttributeSequenceOfInteger::Length() int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)-> Length(); + aValue = dynamic_cast(_local_impl)-> Length(); } else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)-> Length(); return aValue; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx index a747bc0af..103ad9827 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeSequenceOfInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSequenceOfInteger { public: - SALOMEDS_AttributeSequenceOfInteger(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr); + SALOMEDS_AttributeSequenceOfInteger(SALOMEDSImpl_AttributeSequenceOfInteger* theAttr); SALOMEDS_AttributeSequenceOfInteger(SALOMEDS::AttributeSequenceOfInteger_ptr theAttr); ~SALOMEDS_AttributeSequenceOfInteger(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx index 892646911..311b3a6fa 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.cxx @@ -24,7 +24,8 @@ #include "SALOMEDS_AttributeSequenceOfInteger_i.hxx" #include "SALOMEDS.hxx" -#include +#include + using namespace std; @@ -33,22 +34,20 @@ void SALOMEDS_AttributeSequenceOfInteger_i::Assign(const SALOMEDS::LongSeq& othe { 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); + vector aSeq; + for(int i = 0, len = other.length(); i(_impl)->Assign(aSeq); } 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);; + const vector& CasCadeSeq = dynamic_cast(_impl)->Array(); + int len = CasCadeSeq.size(); + CorbaSeq->length(len); + for (int i = 0; i < len; i++) { + CorbaSeq[i] = CasCadeSeq[i]; } return CorbaSeq._retn(); } @@ -57,32 +56,32 @@ void SALOMEDS_AttributeSequenceOfInteger_i::Add(CORBA::Long value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Add(value); + dynamic_cast(_impl)->Add(value); } void SALOMEDS_AttributeSequenceOfInteger_i::Remove(CORBA::Long index) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Remove(index); + dynamic_cast(_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); + dynamic_cast(_impl)->ChangeValue(index, value); } CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Value(CORBA::Short index) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Value(index); + return dynamic_cast(_impl)->Value(index); } CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Length() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Length(); + return dynamic_cast(_impl)->Length(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx index 4ff9e2edf..d5fe4b5d2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfInteger_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeSequenceOfInteger_i: public virtual POA_SALOMEDS::Attrib { public: - SALOMEDS_AttributeSequenceOfInteger_i(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr,CORBA::ORB_ptr orb) + SALOMEDS_AttributeSequenceOfInteger_i(SALOMEDSImpl_AttributeSequenceOfInteger* theAttr,CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeSequenceOfInteger_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx index ec1b6811b..18c844028 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.cxx @@ -24,12 +24,8 @@ #include "SALOMEDS_AttributeSequenceOfReal.hxx" #include "SALOMEDS.hxx" -#include -#include -#include - SALOMEDS_AttributeSequenceOfReal::SALOMEDS_AttributeSequenceOfReal - (const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr) + (SALOMEDSImpl_AttributeSequenceOfReal* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -47,9 +43,7 @@ void SALOMEDS_AttributeSequenceOfReal::Assign(const std::vector& other) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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); + dynamic_cast(_local_impl)->Assign(other); } else { SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq(); @@ -65,8 +59,8 @@ std::vector SALOMEDS_AttributeSequenceOfReal::CorbaSequence() int i, aLength; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfReal) aSeqAttr; - aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl); + SALOMEDSImpl_AttributeSequenceOfReal* aSeqAttr = NULL; + aSeqAttr = dynamic_cast(_local_impl); aLength = aSeqAttr->Length(); for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i)); } @@ -83,7 +77,7 @@ void SALOMEDS_AttributeSequenceOfReal::Add(double value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Add(value); + dynamic_cast(_local_impl)->Add(value); } else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Add(value); } @@ -93,7 +87,7 @@ void SALOMEDS_AttributeSequenceOfReal::Remove(int index) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Remove(index); + dynamic_cast(_local_impl)->Remove(index); } else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Remove(index); } @@ -103,7 +97,7 @@ void SALOMEDS_AttributeSequenceOfReal::ChangeValue(int index, double value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->ChangeValue(index, value); + dynamic_cast(_local_impl)->ChangeValue(index, value); } else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->ChangeValue(index, value); } @@ -113,7 +107,7 @@ double SALOMEDS_AttributeSequenceOfReal::Value(int index) double aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Value(index); + aValue = dynamic_cast(_local_impl)->Value(index); } else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Value(index); return aValue; @@ -124,7 +118,7 @@ int SALOMEDS_AttributeSequenceOfReal::Length() int aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)-> Length(); + aValue = dynamic_cast(_local_impl)-> Length(); } else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)-> Length(); return aValue; diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx index 7688880f6..473e28939 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeSequenceOfReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSequenceOfReal { public: - SALOMEDS_AttributeSequenceOfReal(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr); + SALOMEDS_AttributeSequenceOfReal(SALOMEDSImpl_AttributeSequenceOfReal* theAttr); SALOMEDS_AttributeSequenceOfReal(SALOMEDS::AttributeSequenceOfReal_ptr theAttr); ~SALOMEDS_AttributeSequenceOfReal(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx index 090af5931..7dcaf5dea 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.cxx @@ -24,7 +24,7 @@ #include "SALOMEDS_AttributeSequenceOfReal_i.hxx" #include "SALOMEDS.hxx" -#include +#include using namespace std; @@ -32,21 +32,22 @@ void SALOMEDS_AttributeSequenceOfReal_i::Assign(const SALOMEDS::DoubleSeq& other { SALOMEDS::Locker lock; CheckLocked(); - Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal; + vector CasCadeSeq; for (int i = 0; i < other.length(); i++) { - CasCadeSeq->Append(other[i]); + CasCadeSeq.push_back(other[i]); } - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Assign(CasCadeSeq); + dynamic_cast(_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);; + const vector& CasCadeSeq = dynamic_cast(_impl)->Array(); + int len = CasCadeSeq.size(); + CorbaSeq->length(len); + for (int i = 0; i < len; i++) { + CorbaSeq[i] = CasCadeSeq[i]; } return CorbaSeq._retn(); } @@ -55,32 +56,32 @@ void SALOMEDS_AttributeSequenceOfReal_i::Add(CORBA::Double value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Add(value); + dynamic_cast(_impl)->Add(value); } void SALOMEDS_AttributeSequenceOfReal_i::Remove(CORBA::Long index) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Remove(index); + dynamic_cast(_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); + dynamic_cast(_impl)->ChangeValue(index, value); } CORBA::Double SALOMEDS_AttributeSequenceOfReal_i::Value(CORBA::Short index) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Value(index); + return dynamic_cast(_impl)->Value(index); } CORBA::Long SALOMEDS_AttributeSequenceOfReal_i::Length() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Length(); + return dynamic_cast(_impl)->Length(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx index 1a70f96ca..3fcbea33f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeSequenceOfReal_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeSequenceOfReal_i: public virtual POA_SALOMEDS::Attribute public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeSequenceOfReal_i(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeSequenceOfReal_i(SALOMEDSImpl_AttributeSequenceOfReal* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeSequenceOfReal_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeString.cxx b/src/SALOMEDS/SALOMEDS_AttributeString.cxx index dcf1f06fd..6feb94ba6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeString.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString.cxx @@ -25,10 +25,8 @@ #include "SALOMEDS.hxx" #include -#include -#include -SALOMEDS_AttributeString::SALOMEDS_AttributeString(const Handle(SALOMEDSImpl_AttributeString)& theAttr) +SALOMEDS_AttributeString::SALOMEDS_AttributeString(SALOMEDSImpl_AttributeString* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,8 +42,7 @@ std::string SALOMEDS_AttributeString::Value() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeString):: - DownCast(_local_impl)->Value()).ToCString(); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeString::_narrow(_corba_impl)->Value(); return aValue; @@ -56,7 +53,7 @@ void SALOMEDS_AttributeString::SetValue(const std::string& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeString)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeString::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeString.hxx b/src/SALOMEDS/SALOMEDS_AttributeString.hxx index 025ae7836..8f7942903 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeString.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeString { public: - SALOMEDS_AttributeString(const Handle(SALOMEDSImpl_AttributeString)& theAttr); + SALOMEDS_AttributeString(SALOMEDSImpl_AttributeString* theAttr); SALOMEDS_AttributeString(SALOMEDS::AttributeString_ptr theAttr); ~SALOMEDS_AttributeString(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx index 62f9de652..468c9720d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx @@ -24,7 +24,6 @@ #include "SALOMEDS_AttributeString_i.hxx" -#include #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDS.hxx" @@ -35,7 +34,7 @@ char* SALOMEDS_AttributeString_i::Value() SALOMEDS::Locker lock; CORBA::String_var c_s = - CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeString)::DownCast(_impl)->Value()).ToCString()); + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); return c_s._retn(); } @@ -44,6 +43,5 @@ void SALOMEDS_AttributeString_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); - TCollection_AsciiString aStr((char*)value); - Handle(SALOMEDSImpl_AttributeString)::DownCast(_impl)->SetValue(TCollection_ExtendedString(aStr)); + dynamic_cast(_impl)->SetValue(string(value)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx index 1fa8e024f..b95b5eb8f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeString_i: public virtual POA_SALOMEDS::AttributeString, public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeString_i(const Handle(SALOMEDSImpl_AttributeString)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeString_i(SALOMEDSImpl_AttributeString* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; virtual ~SALOMEDS_AttributeString_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx index 3bc0afd3d..d3ca2e668 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx @@ -24,14 +24,10 @@ #include "SALOMEDS_AttributeStudyProperties.hxx" #include "SALOMEDS.hxx" -#include -#include -#include -#include -#include +using namespace std; SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties - (const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr) + (SALOMEDSImpl_AttributeStudyProperties* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -49,9 +45,9 @@ void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl); - anImpl->ChangeCreatorName((char*)theName.c_str()); + SALOMEDSImpl_AttributeStudyProperties* anImpl = + dynamic_cast(_local_impl); + anImpl->ChangeCreatorName(theName); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str()); } @@ -61,9 +57,7 @@ std::string SALOMEDS_AttributeStudyProperties::GetUserName() std::string aName; if (_isLocal) { SALOMEDS::Locker lock; - TCollection_ExtendedString S = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreatorName(); - aName = TCollection_AsciiString(S).ToCString(); + aName = dynamic_cast(_local_impl)->GetCreatorName(); } #ifndef WNT else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName(); @@ -79,11 +73,11 @@ void SALOMEDS_AttributeStudyProperties::SetCreationDate if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl); + SALOMEDSImpl_AttributeStudyProperties* anImpl = + dynamic_cast(_local_impl); int aTmp; if (anImpl->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return; - TCollection_ExtendedString S; + string S; anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear); } else { SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute, @@ -103,7 +97,7 @@ bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute, bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast + ret = dynamic_cast (_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear); } else { CORBA::Long aMinute, anHour, aDay, aMonth, anYear; @@ -127,11 +121,11 @@ void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMo CheckLocked(); SALOMEDS::Locker lock; if (theMode == "from scratch") - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(1); + dynamic_cast(_local_impl)->SetCreationMode(1); else if (theMode == "copy from") - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(2); + dynamic_cast(_local_impl)->SetCreationMode(2); else //Not defined - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(0); + dynamic_cast(_local_impl)->SetCreationMode(0); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str()); } @@ -141,7 +135,7 @@ std::string SALOMEDS_AttributeStudyProperties::GetCreationMode() std::string aMode; if (_isLocal) { SALOMEDS::Locker lock; - int mode = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationMode(); + int mode = dynamic_cast(_local_impl)->GetCreationMode(); if (mode == 1) aMode = "from scratch"; if (mode == 2) aMode = "copy from"; } @@ -154,7 +148,7 @@ void SALOMEDS_AttributeStudyProperties::SetModified(int theModified) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModified(theModified); + dynamic_cast(_local_impl)->SetModified(theModified); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified); @@ -165,7 +159,7 @@ bool SALOMEDS_AttributeStudyProperties::IsModified() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsModified(); + ret = dynamic_cast(_local_impl)->IsModified(); } else ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified(); @@ -177,7 +171,7 @@ int SALOMEDS_AttributeStudyProperties::GetModified() int isModified; if (_isLocal) { SALOMEDS::Locker lock; - isModified = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModified(); + isModified = dynamic_cast(_local_impl)->GetModified(); } else isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified(); @@ -188,7 +182,7 @@ void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetLocked(theLocked); + dynamic_cast(_local_impl)->SetLocked(theLocked); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked); @@ -199,7 +193,7 @@ bool SALOMEDS_AttributeStudyProperties::IsLocked() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsLocked(); + ret = dynamic_cast(_local_impl)->IsLocked(); } else ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked(); @@ -216,9 +210,8 @@ void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theNa if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl); - anImpl->SetModification((char*)theName.c_str(), theMinute, theHour, theDay, theMonth, theYear); + SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast(_local_impl); + anImpl->SetModification(theName, theMinute, theHour, theDay, theMonth, theYear); } else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(), theMinute, @@ -240,20 +233,19 @@ void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vector aNames; + vector aMinutes, aHours, aDays, aMonths, aYears; + SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast(_local_impl); anImpl->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); - aLength = aNames->Length(); + aLength = aNames.size(); 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)); + theNames.push_back(aNames[i-1]); + theMinutes.push_back(aMinutes[i-1]); + theHours.push_back(aHours[i-1]); + theDays.push_back(aDays[i-1]); + theMonths.push_back(aMonths[i-1]); + theYears.push_back(aYears[i-1]); } } else { SALOMEDS::StringSeq_var aNames; diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx index 79f3b0684..96eaee418 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx @@ -24,13 +24,13 @@ #ifndef SALOMEDS_AttributeStudyProperties_HeaderFile #define SALOMEDS_AttributeStudyProperties_HeaderFile -#include -#include - #include "SALOMEDSClient_AttributeStudyProperties.hxx" #include "SALOMEDS_GenericAttribute.hxx" #include "SALOMEDSImpl_AttributeStudyProperties.hxx" +#include +#include + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) @@ -44,7 +44,7 @@ class Standard_EXPORT SALOMEDS_AttributeStudyProperties: public SALOMEDS_Generic { public: - SALOMEDS_AttributeStudyProperties(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr); + SALOMEDS_AttributeStudyProperties(SALOMEDSImpl_AttributeStudyProperties* theAttr); SALOMEDS_AttributeStudyProperties(SALOMEDS::AttributeStudyProperties_ptr theAttr); ~SALOMEDS_AttributeStudyProperties(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx index 1160a058a..149fa2094 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx @@ -24,10 +24,6 @@ #include "SALOMEDS_AttributeStudyProperties_i.hxx" #include "SALOMEDS.hxx" -#include -#include -#include - using namespace std; #define CREATION_MODE_NOTDEFINED 0 @@ -38,15 +34,14 @@ void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->ChangeCreatorName((char*)theName); + dynamic_cast(_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()); + string S = dynamic_cast(_impl)->GetCreatorName(); + CORBA::String_var c_s = CORBA::string_dup(S.c_str()); return c_s._retn(); } @@ -58,11 +53,10 @@ void SALOMEDS_AttributeStudyProperties_i::SetCreationDate(CORBA::Long theMinute, { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast(_impl); int aTmp; if (aProp->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return; - TCollection_ExtendedString S; + string S; aProp->SetModification(S, theMinute, theHour, theDay, theMonth, theYear); } @@ -73,29 +67,27 @@ CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::GetCreationDate(CORBA::Long& 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)) { + int aMinute; + int aHour; + int aDay; + int aMonth; + int aYear; + if (dynamic_cast(_impl)->GetCreationDate(aMinute, aHour, aDay, aMonth, aYear)) { theMinute = aMinute; theHour = aHour; theDay = aDay; theMonth = aMonth; theYear = aYear; - return Standard_True; + return true; } - return Standard_False; + return false; } void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast(_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); @@ -105,7 +97,7 @@ char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode() { SALOMEDS::Locker lock; CORBA::String_var c_s; - switch (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreationMode()) { + switch (dynamic_cast(_impl)->GetCreationMode()) { case CREATION_MODE_SCRATCH: c_s = "from scratch"; break; case CREATION_MODE_COPY: c_s = "copy from"; break; default: c_s = ""; @@ -116,31 +108,31 @@ char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode() void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetModified(theModified); + dynamic_cast(_impl)->SetModified(theModified); } CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsModified(); + return dynamic_cast(_impl)->IsModified(); } CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetModified(); + return dynamic_cast(_impl)->GetModified(); } void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetLocked(theLocked); + dynamic_cast(_impl)->SetLocked(theLocked); } CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsLocked() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsLocked(); + return dynamic_cast(_impl)->IsLocked(); } void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName, @@ -152,8 +144,7 @@ void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName, { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl); + SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast(_impl); aProp->SetModification((char*)theName, (int)theMinute, (int)theHour, (int)theDay, (int)theMonth, (int)theYear); } @@ -167,12 +158,11 @@ void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringS 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); + vector aNames; + vector aMinutes, aHours, aDays, aMonths, aYears; + SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast(_impl); aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); - int aLength = aNames->Length(); + int aLength = aNames.size(); int aRetLength = aLength - ((theWithCreator) ? 0 : 1); theNames = new SALOMEDS::StringSeq; theMinutes = new SALOMEDS::LongSeq; @@ -188,11 +178,11 @@ void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringS 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); + (*theNames)[a] = CORBA::string_dup(aNames[ind-1].c_str()); + (*theMinutes)[a] = aMinutes[ind-1]; + (*theHours)[a] = aHours[ind-1]; + (*theDays)[a] = aDays[ind-1]; + (*theMonths)[a] = aMonths[ind-1]; + (*theYears)[a] = aYears[ind-1]; } } diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx index f08edbffc..c41e15abe 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeStudyProperties_i: public virtual POA_SALOMEDS::Attribut public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeStudyProperties_i(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeStudyProperties_i(SALOMEDSImpl_AttributeStudyProperties* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeStudyProperties_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx index 829dd0205..58042dfaa 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx @@ -24,14 +24,10 @@ #include "SALOMEDS_AttributeTableOfInteger.hxx" #include "SALOMEDS.hxx" -#include -#include -#include -#include - +using namespace std; SALOMEDS_AttributeTableOfInteger::SALOMEDS_AttributeTableOfInteger - (const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr) + (SALOMEDSImpl_AttributeTableOfInteger* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -49,7 +45,7 @@ void SALOMEDS_AttributeTableOfInteger::SetTitle(const std::string& theTitle) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetTitle(theTitle); } else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetTitle(theTitle.c_str()); } @@ -59,8 +55,7 @@ std::string SALOMEDS_AttributeTableOfInteger::GetTitle() std::string aStr; if (_isLocal) { SALOMEDS::Locker lock; - aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->GetTitle()).ToCString(); + aStr = dynamic_cast(_local_impl)->GetTitle(); } else aStr = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetTitle(); return aStr; @@ -71,8 +66,7 @@ void SALOMEDS_AttributeTableOfInteger::SetRowTitle(int theIndex, const std::stri if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetRowTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str()); } @@ -83,9 +77,9 @@ void SALOMEDS_AttributeTableOfInteger::SetRowTitles(const std::vectorAppend((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowTitles(aSeq); + vector aSeq; + for (i = 0; i < aLength; i++) aSeq.push_back(theTitles[i]); + dynamic_cast(_local_impl)->SetRowTitles(aSeq); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -102,10 +96,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRowTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetRowTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowTitles(); @@ -120,8 +111,7 @@ void SALOMEDS_AttributeTableOfInteger::SetColumnTitle(int theIndex, const std::s if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetColumnTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str()); } @@ -132,9 +122,9 @@ void SALOMEDS_AttributeTableOfInteger::SetColumnTitles(const std::vectorAppend((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetColumnTitles(aSeq); + vector aSeq; + for (i = 0; i < aLength; i++) aSeq.push_back(theTitles[i]); + dynamic_cast(_local_impl)->SetColumnTitles(aSeq); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -150,10 +140,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetColumnTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetColumnTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumnTitles(); @@ -168,8 +155,7 @@ void SALOMEDS_AttributeTableOfInteger::SetRowUnit(int theIndex, const std::strin if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str()); + dynamic_cast(_local_impl)->SetRowUnit(theIndex, theUnit); } else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str()); } @@ -180,9 +166,7 @@ void SALOMEDS_AttributeTableOfInteger::SetRowUnits(const std::vectorAppend((char*)theUnits[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowUnits(aSeq); + dynamic_cast(_local_impl)->SetRowUnits(theUnits); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -198,10 +182,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRowUnits() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetRowUnits(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowUnits(); @@ -216,7 +197,7 @@ int SALOMEDS_AttributeTableOfInteger::GetNbRows() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbRows(); + aNb = dynamic_cast(_local_impl)->GetNbRows(); } else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbRows(); return aNb; @@ -227,7 +208,7 @@ int SALOMEDS_AttributeTableOfInteger::GetNbColumns() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbColumns(); + aNb = dynamic_cast(_local_impl)->GetNbColumns(); } else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbColumns(); return aNb; @@ -240,12 +221,9 @@ void SALOMEDS_AttributeTableOfInteger::AddRow(const std::vector& theData) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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]); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(aTable->GetNbRows() + 1, aRow); + aTable->SetRowData(aTable->GetNbRows() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); @@ -265,12 +243,9 @@ void SALOMEDS_AttributeTableOfInteger::SetRow(int theRow, const std::vector if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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]); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(theRow, aRow); + aTable->SetRowData(theRow, theData); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); @@ -290,10 +265,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRow(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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)); + aVector = dynamic_cast(_local_impl)->GetRowData(theRow); } else { SALOMEDS::LongSeq_var aRow = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRow(theRow); @@ -310,12 +282,9 @@ void SALOMEDS_AttributeTableOfInteger::AddColumn(const std::vector& theData if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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]); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); + aTable->SetColumnData(aTable->GetNbColumns() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); @@ -335,12 +304,9 @@ void SALOMEDS_AttributeTableOfInteger::SetColumn(int theColumn, const std::vecto if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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]); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(theColumn, aColumn); + aTable->SetColumnData(theColumn, theData); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); @@ -360,10 +326,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetColumn(int theColumn) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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)); + aVector = dynamic_cast(_local_impl)->GetColumnData(theColumn); } else { SALOMEDS::LongSeq_var aColumn = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumn(theColumn); @@ -379,8 +342,7 @@ void SALOMEDS_AttributeTableOfInteger::PutValue(int theValue, int theRow, int th CheckLocked(); SALOMEDS::Locker lock; try { - Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->PutValue(theValue, theRow, theColumn); + dynamic_cast(_local_impl)->PutValue(theValue, theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); @@ -396,7 +358,7 @@ bool SALOMEDS_AttributeTableOfInteger::HasValue(int theRow, int theColumn) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->HasValue(theRow, theColumn); + ret = dynamic_cast(_local_impl)->HasValue(theRow, theColumn); } else ret = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->HasValue(theRow, theColumn); return ret; @@ -408,8 +370,7 @@ int SALOMEDS_AttributeTableOfInteger::GetValue(int theRow, int theColumn) if (_isLocal) { SALOMEDS::Locker lock; try { - aValue = Handle(SALOMEDSImpl_AttributeTableOfInteger):: - DownCast(_local_impl)->GetValue(theRow, theColumn); + aValue = dynamic_cast(_local_impl)->GetValue(theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); @@ -427,10 +388,7 @@ std::vector SALOMEDS_AttributeTableOfInteger::GetRowSetIndices(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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)); + aVector = dynamic_cast(_local_impl)->GetSetRowIndices(theRow); } else { SALOMEDS::LongSeq_var aSet = @@ -445,7 +403,7 @@ void SALOMEDS_AttributeTableOfInteger::SetNbColumns(int theNbColumns) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetNbColumns(theNbColumns); + dynamic_cast(_local_impl)->SetNbColumns(theNbColumns); } else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetNbColumns(theNbColumns); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx index 34e51b024..5405e049f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeTableOfInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfInteger { public: - SALOMEDS_AttributeTableOfInteger(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr); + SALOMEDS_AttributeTableOfInteger(SALOMEDSImpl_AttributeTableOfInteger* theAttr); SALOMEDS_AttributeTableOfInteger(SALOMEDS::AttributeTableOfInteger_ptr theAttr); ~SALOMEDS_AttributeTableOfInteger(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx index 867219dc7..aab700b1b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx @@ -25,14 +25,12 @@ #include "SALOMEDS_AttributeTableOfInteger_i.hxx" #include "SALOMEDS.hxx" -#include -#include -#include #include "Utils_ExceptHandlers.hxx" #include #include #include +#include using namespace std; @@ -44,14 +42,14 @@ 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)); + dynamic_cast(_impl)->SetTitle(string(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()); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); + CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str()); return c_s._retn(); } @@ -61,9 +59,9 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowTitle(CORBA::Long theIndex, const SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); - aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); + aTable->SetRowTitle(theIndex, string(theTitle)); } void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) @@ -72,7 +70,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); for (int i = 0; i < theTitles.length(); i++) { SetRowTitle(i + 1, theTitles[i]); @@ -82,11 +80,11 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_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()); + aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str()); return aTitles._retn(); } @@ -96,10 +94,10 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitle(CORBA::Long theIndex, co SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_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)); + aTable->SetColumnTitle(theIndex, string(aStr)); } void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles) @@ -108,7 +106,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringS SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_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()); @@ -118,11 +116,11 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringS SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_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()); + aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str()); return aTitles._retn(); } @@ -133,9 +131,9 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowUnit(CORBA::Long theIndex, const SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); - aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit)); + aTable->SetRowUnit(theIndex, string(theUnit)); } void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) @@ -144,7 +142,7 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& SALOMEDS::Locker lock; Unexpect aCatch (ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_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()); @@ -154,24 +152,24 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_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()); + aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str()); return aUnits._retn(); } CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbRows() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->GetNbRows(); + return dynamic_cast(_impl)->GetNbRows(); } CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbColumns() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->GetNbColumns(); + return dynamic_cast(_impl)->GetNbColumns(); } void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData) @@ -180,14 +178,14 @@ void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger; - for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]); try { aTable->SetRowData(aTable->GetNbRows() + 1, aRow); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); } } @@ -198,14 +196,14 @@ void SALOMEDS_AttributeTableOfInteger_i::SetRow(CORBA::Long theRow, const SALOME SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger; - for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]); try { aTable->SetRowData(theRow, aRow); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); } } @@ -215,14 +213,14 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRow(CORBA::Long theRow { SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_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); + vector aRow = aTable->GetRowData(theRow); + CorbaSeq->length(aRow.size()); + for (int i = 0; i < aRow.size(); i++) { + CorbaSeq[i] = aRow[i]; } return CorbaSeq._retn(); } @@ -233,14 +231,14 @@ void SALOMEDS_AttributeTableOfInteger_i::AddColumn(const SALOMEDS::LongSeq& theD SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger; - for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]); try { aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); } } @@ -251,14 +249,14 @@ void SALOMEDS_AttributeTableOfInteger_i::SetColumn(CORBA::Long theColumn, const 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]); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); + + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]); try { aTable->SetColumnData(theColumn, aColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); } } @@ -268,14 +266,14 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumn(CORBA::Long the { SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_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); + vector aColumn = aTable->GetColumnData(theColumn); + CorbaSeq->length(aColumn.size()); + for (int i = 0; i < aColumn.size(); i++) { + CorbaSeq[i] = aColumn[i]; } return CorbaSeq._retn(); } @@ -286,12 +284,12 @@ void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::L SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); try { aTable->PutValue(theValue, theRow, theColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); } } @@ -299,7 +297,7 @@ void SALOMEDS_AttributeTableOfInteger_i::PutValue(CORBA::Long theValue, CORBA::L CORBA::Boolean SALOMEDS_AttributeTableOfInteger_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->HasValue(theRow, theColumn); + return dynamic_cast(_impl)->HasValue(theRow, theColumn); } CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn) @@ -307,14 +305,14 @@ CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, COR { SALOMEDS::Locker lock; Unexpect aCatch(ATI_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); CORBA::Long aValue; try { aValue = aTable->GetValue(theRow, theColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex(); } return aValue; @@ -323,15 +321,15 @@ CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, COR SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::Long theRow) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_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); + vector aSeq = aTable->GetSetRowIndices(theRow); + CorbaSeq->length(aSeq.size()); + for (int i = 0; i < aSeq.size(); i++) { + CorbaSeq[i] = aSeq[i]; } return CorbaSeq._retn(); } @@ -340,29 +338,26 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::L void SALOMEDS_AttributeTableOfInteger_i::SetNbColumns(CORBA::Long theNbColumns) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_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); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); - istrstream aStream((char*)&theStream[0], theStream.length()); - return aTable->RestoreFromString(aStream); + string aStream((char*)&theStream[0], theStream.length()); + aTable->Load(aStream); + return true; } 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); + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(_impl); - aString = ostr.rdbuf()->str(); + string aString = aTable->Save(); char* aBuffer = (char*)CORBA::string_dup(aString.c_str()); int aBufferSize = strlen((char*)aBuffer); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx index 93ec94149..47a2909b1 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeTableOfInteger_i: public virtual POA_SALOMEDS::Attribute public: - SALOMEDS_AttributeTableOfInteger_i(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTableOfInteger_i(SALOMEDSImpl_AttributeTableOfInteger* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTableOfInteger_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx index f695ed2ad..8368f11c2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx @@ -24,15 +24,10 @@ #include "SALOMEDS_AttributeTableOfReal.hxx" #include "SALOMEDS.hxx" -#include -#include -#include -#include -#include - +using namespace std; SALOMEDS_AttributeTableOfReal::SALOMEDS_AttributeTableOfReal - (const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr) + (SALOMEDSImpl_AttributeTableOfReal* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -49,7 +44,7 @@ void SALOMEDS_AttributeTableOfReal::SetTitle(const std::string& theTitle) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetTitle(theTitle); } else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetTitle(theTitle.c_str()); } @@ -59,8 +54,7 @@ std::string SALOMEDS_AttributeTableOfReal::GetTitle() std::string aStr; if (_isLocal) { SALOMEDS::Locker lock; - aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfReal):: - DownCast(_local_impl)->GetTitle()).ToCString(); + aStr = dynamic_cast(_local_impl)->GetTitle(); } else aStr = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetTitle(); return aStr; @@ -71,8 +65,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowTitle(int theIndex, const std::string& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal):: - DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetRowTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str()); } @@ -84,9 +77,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowTitles(const std::vector& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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); + dynamic_cast(_local_impl)->SetRowTitles(theTitles); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -102,10 +93,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRowTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetRowTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowTitles(); @@ -120,8 +108,7 @@ void SALOMEDS_AttributeTableOfReal::SetColumnTitle(int theIndex, const std::stri if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal):: - DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetColumnTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str()); } @@ -132,9 +119,7 @@ void SALOMEDS_AttributeTableOfReal::SetColumnTitles(const std::vectorAppend((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetColumnTitles(aSeq); + dynamic_cast(_local_impl)->SetColumnTitles(theTitles); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -150,10 +135,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetColumnTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetColumnTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumnTitles(); @@ -168,8 +150,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowUnit(int theIndex, const std::string& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal):: - DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str()); + dynamic_cast(_local_impl)->SetRowUnit(theIndex, theUnit); } else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str()); } @@ -180,9 +161,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowUnits(const std::vector& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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); + dynamic_cast(_local_impl)->SetRowUnits(theUnits); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -198,15 +177,12 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRowUnits() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetRowUnits(); } 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()); + for (i = 0; i < aLength; i++) aVector.push_back(string(aSeq[i].in())); } return aVector; } @@ -216,7 +192,7 @@ int SALOMEDS_AttributeTableOfReal::GetNbRows() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbRows(); + aNb = dynamic_cast(_local_impl)->GetNbRows(); } else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbRows(); return aNb; @@ -227,7 +203,7 @@ int SALOMEDS_AttributeTableOfReal::GetNbColumns() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbColumns(); + aNb = dynamic_cast(_local_impl)->GetNbColumns(); } else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbColumns(); return aNb; @@ -239,12 +215,9 @@ void SALOMEDS_AttributeTableOfReal::AddRow(const std::vector& theData) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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]); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(aTable->GetNbRows() + 1, aRow); + aTable->SetRowData(aTable->GetNbRows() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); @@ -264,12 +237,9 @@ void SALOMEDS_AttributeTableOfReal::SetRow(int theRow, const std::vector if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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]); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(theRow, aRow); + aTable->SetRowData(theRow, theData); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); @@ -289,10 +259,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRow(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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)); + aVector = dynamic_cast(_local_impl)->GetRowData(theRow); } else { SALOMEDS::DoubleSeq_var aRow = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRow(theRow); @@ -309,12 +276,9 @@ void SALOMEDS_AttributeTableOfReal::AddColumn(const std::vector& theData if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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]); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); + aTable->SetColumnData(aTable->GetNbColumns() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); @@ -334,12 +298,9 @@ void SALOMEDS_AttributeTableOfReal::SetColumn(int theColumn, const std::vectorAppend(theData[i]); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(theColumn, aColumn); + aTable->SetColumnData(theColumn, theData); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); @@ -359,10 +320,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetColumn(int theColumn) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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)); + aVector = dynamic_cast(_local_impl)->GetColumnData(theColumn); } else { SALOMEDS::DoubleSeq_var aColumn = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumn(theColumn); @@ -378,8 +336,7 @@ void SALOMEDS_AttributeTableOfReal::PutValue(double theValue, int theRow, int th CheckLocked(); SALOMEDS::Locker lock; try { - Handle(SALOMEDSImpl_AttributeTableOfReal):: - DownCast(_local_impl)->PutValue(theValue, theRow, theColumn); + dynamic_cast(_local_impl)->PutValue(theValue, theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); @@ -395,7 +352,7 @@ bool SALOMEDS_AttributeTableOfReal::HasValue(int theRow, int theColumn) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->HasValue(theRow, theColumn); + ret = dynamic_cast(_local_impl)->HasValue(theRow, theColumn); } else ret = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->HasValue(theRow, theColumn); return ret; @@ -407,7 +364,7 @@ double SALOMEDS_AttributeTableOfReal::GetValue(int theRow, int theColumn) if (_isLocal) { SALOMEDS::Locker lock; try { - aValue = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetValue(theRow, theColumn); + aValue = dynamic_cast(_local_impl)->GetValue(theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); @@ -425,10 +382,7 @@ std::vector SALOMEDS_AttributeTableOfReal::GetRowSetIndices(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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)); + aVector = dynamic_cast(_local_impl)->GetSetRowIndices(theRow); } else { SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowSetIndices(theRow); @@ -442,7 +396,7 @@ void SALOMEDS_AttributeTableOfReal::SetNbColumns(int theNbColumns) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetNbColumns(theNbColumns); + dynamic_cast(_local_impl)->SetNbColumns(theNbColumns); } else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetNbColumns(theNbColumns); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx index 7846f13cd..e426fcba2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeTableOfReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfReal { public: - SALOMEDS_AttributeTableOfReal(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr); + SALOMEDS_AttributeTableOfReal(SALOMEDSImpl_AttributeTableOfReal* theAttr); SALOMEDS_AttributeTableOfReal(SALOMEDS::AttributeTableOfReal_ptr theAttr); ~SALOMEDS_AttributeTableOfReal(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx index ad52deac5..eda6b3944 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx @@ -25,12 +25,9 @@ #include "SALOMEDS_AttributeTableOfReal_i.hxx" #include "SALOMEDS.hxx" -#include -#include -#include - #include #include +#include using namespace std; @@ -42,16 +39,16 @@ void SALOMEDS_AttributeTableOfReal_i::SetTitle(const char* theTitle) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); CORBA::String_var aStr = CORBA::string_dup(theTitle); - aTable->SetTitle(TCollection_ExtendedString(aStr)); + aTable->SetTitle(string(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()); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); + CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str()); return c_s._retn(); } @@ -61,9 +58,9 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowTitle(CORBA::Long theIndex, const ch SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); - aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); + aTable->SetRowTitle(theIndex, string(theTitle)); } void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) @@ -72,7 +69,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& th SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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()); @@ -82,11 +79,11 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& th SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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()); + aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str()); return aTitles._retn(); } @@ -96,10 +93,10 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumnTitle(CORBA::Long theIndex, const SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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)); + aTable->SetColumnTitle(theIndex, string(aStr)); } void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles) @@ -108,7 +105,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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()); @@ -118,11 +115,11 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetColumnTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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()); + aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str()); return aTitles._retn(); } @@ -133,9 +130,9 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowUnit(CORBA::Long theIndex, const cha SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); - aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit)); + aTable->SetRowUnit(theIndex, string(theUnit)); } void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) @@ -144,7 +141,7 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& the SALOMEDS::Locker lock; Unexpect aCatch (ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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()); @@ -154,11 +151,11 @@ void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& the SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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()); + aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str()); return aUnits._retn(); } @@ -166,13 +163,13 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits() CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbRows() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->GetNbRows(); + return dynamic_cast(_impl)->GetNbRows(); } CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbColumns() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->GetNbColumns(); + return dynamic_cast(_impl)->GetNbColumns(); } void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData) @@ -181,10 +178,10 @@ void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData) SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal; - for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]); aTable->SetRowData(aTable->GetNbRows() + 1, aRow); } @@ -194,10 +191,10 @@ void SALOMEDS_AttributeTableOfReal_i::SetRow(CORBA::Long theRow, const SALOMEDS: SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal; - for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]); aTable->SetRowData(theRow, aRow); } @@ -206,14 +203,14 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetRow(CORBA::Long theRow) { SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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); + vector aRow = aTable->GetRowData(theRow); + CorbaSeq->length(aRow.size()); + for (int i = 0; i < aRow.size(); i++) { + CorbaSeq[i] = aRow[i]; } return CorbaSeq._retn(); } @@ -224,10 +221,10 @@ void SALOMEDS_AttributeTableOfReal_i::AddColumn(const SALOMEDS::DoubleSeq& theDa SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal; - for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]); aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); } @@ -237,10 +234,10 @@ void SALOMEDS_AttributeTableOfReal_i::SetColumn(CORBA::Long theColumn, const SAL SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); - Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal; - for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]); + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]); aTable->SetColumnData(theColumn, aColumn); } @@ -249,14 +246,14 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeTableOfReal_i::GetColumn(CORBA::Long theC { SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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); + vector aColumn = aTable->GetColumnData(theColumn); + CorbaSeq->length(aColumn.size()); + for (int i = 0; i < aColumn.size(); i++) { + CorbaSeq[i] = aColumn[i]; } return CorbaSeq._retn(); } @@ -267,7 +264,7 @@ void SALOMEDS_AttributeTableOfReal_i::PutValue(CORBA::Double theValue, CORBA::Lo SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); aTable->PutValue(theValue, theRow, theColumn); } @@ -275,7 +272,7 @@ void SALOMEDS_AttributeTableOfReal_i::PutValue(CORBA::Double theValue, CORBA::Lo CORBA::Boolean SALOMEDS_AttributeTableOfReal_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->HasValue(theRow, theColumn); + return dynamic_cast(_impl)->HasValue(theRow, theColumn); } CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn) @@ -283,7 +280,7 @@ CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORB { SALOMEDS::Locker lock; Unexpect aCatch(ATR_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); CORBA::Double aValue; @@ -291,7 +288,7 @@ CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORB try { aValue = aTable->GetValue(theRow, theColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectIndex(); } @@ -302,15 +299,16 @@ CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORB SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::GetRowSetIndices(CORBA::Long theRow) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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); + vector aSeq = aTable->GetSetRowIndices(theRow); + int len = aSeq.size(); + CorbaSeq->length(len); + for (int i = 0; i < len; i++) { + CorbaSeq[i] = aSeq[i]; } return CorbaSeq._retn(); } @@ -319,30 +317,26 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::GetRowSetIndices(CORBA::Long void SALOMEDS_AttributeTableOfReal_i::SetNbColumns(CORBA::Long theNbColumns) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_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); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); - istrstream aStream((char*)&theStream[0], theStream.length()); - return aTable->RestoreFromString(aStream); + string aStream((char*)&theStream[0], theStream.length()); + aTable->Load(aStream); + return true; } 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(); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_impl); + string aString = aTable->Save(); char* aBuffer = (char*)CORBA::string_dup(aString.c_str()); int aBufferSize = strlen((char*)aBuffer); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx index 6f496a66a..52538c58e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeTableOfReal_i: public virtual POA_SALOMEDS::AttributeTab public: - SALOMEDS_AttributeTableOfReal_i(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTableOfReal_i(SALOMEDSImpl_AttributeTableOfReal* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTableOfReal_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx index b416e0691..0637130fa 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx @@ -25,14 +25,11 @@ #include "SALOMEDS.hxx" #include -#include -#include -#include -#include -#include + +using namespace std; SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString - (const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr) + (SALOMEDSImpl_AttributeTableOfString* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -50,7 +47,7 @@ void SALOMEDS_AttributeTableOfString::SetTitle(const std::string& theTitle) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetTitle(theTitle); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetTitle(theTitle.c_str()); } @@ -60,8 +57,7 @@ std::string SALOMEDS_AttributeTableOfString::GetTitle() std::string aStr; if (_isLocal) { SALOMEDS::Locker lock; - aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->GetTitle()).ToCString(); + aStr = dynamic_cast(_local_impl)->GetTitle(); } else aStr = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetTitle(); return aStr; @@ -72,8 +68,7 @@ void SALOMEDS_AttributeTableOfString::SetRowTitle(int theIndex, const std::strin if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetRowTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str()); } @@ -84,9 +79,7 @@ void SALOMEDS_AttributeTableOfString::SetRowTitles(const std::vectorAppend((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowTitles(aSeq); + dynamic_cast(_local_impl)->SetRowTitles(theTitles); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -102,10 +95,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRowTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetRowTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowTitles(); @@ -120,8 +110,7 @@ void SALOMEDS_AttributeTableOfString::SetColumnTitle(int theIndex, const std::st if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str()); + dynamic_cast(_local_impl)->SetColumnTitle(theIndex, theTitle); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str()); } @@ -132,9 +121,7 @@ void SALOMEDS_AttributeTableOfString::SetColumnTitles(const std::vectorAppend((char*)theTitles[i].c_str()); - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetColumnTitles(aSeq); + dynamic_cast(_local_impl)->SetColumnTitles(theTitles); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -150,10 +137,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetColumnTitles() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetColumnTitles(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumnTitles(); @@ -168,8 +152,7 @@ void SALOMEDS_AttributeTableOfString::SetRowUnit(int theIndex, const std::string if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str()); + dynamic_cast(_local_impl)->SetRowUnit(theIndex, theUnit); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str()); } @@ -180,9 +163,7 @@ void SALOMEDS_AttributeTableOfString::SetRowUnits(const std::vector if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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); + dynamic_cast(_local_impl)->SetRowUnits(theUnits); } else { SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq(); @@ -198,10 +179,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRowUnits() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetRowUnits(); } else { SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowUnits(); @@ -216,7 +194,7 @@ int SALOMEDS_AttributeTableOfString::GetNbRows() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbRows(); + aNb = dynamic_cast(_local_impl)->GetNbRows(); } else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbRows(); return aNb; @@ -227,7 +205,7 @@ int SALOMEDS_AttributeTableOfString::GetNbColumns() int aNb; if (_isLocal) { SALOMEDS::Locker lock; - aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbColumns(); + aNb = dynamic_cast(_local_impl)->GetNbColumns(); } else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbColumns(); return aNb; @@ -239,12 +217,9 @@ void SALOMEDS_AttributeTableOfString::AddRow(const std::vector& the if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(aTable->GetNbRows() + 1, aRow); + aTable->SetRowData(aTable->GetNbRows() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); @@ -264,12 +239,9 @@ void SALOMEDS_AttributeTableOfString::SetRow(int theRow, const std::vectorAppend((char*)theData[i].c_str()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(theRow, aRow); + aTable->SetRowData(theRow, theData); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); @@ -289,10 +261,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRow(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetRowData(theRow); } else { SALOMEDS::StringSeq_var aRow = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRow(theRow); @@ -309,12 +278,9 @@ void SALOMEDS_AttributeTableOfString::AddColumn(const std::vector& if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); + aTable->SetColumnData(aTable->GetNbColumns() + 1, theData); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); @@ -334,12 +300,9 @@ void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_local_impl); try { - aTable->SetColumnData(theColumn, aColumn); + aTable->SetColumnData(theColumn, theData); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); @@ -359,12 +322,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetColumn(int theColum int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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()); + aVector = dynamic_cast(_local_impl)->GetColumnData(theColumn); } else { SALOMEDS::StringSeq_var aColumn = @@ -381,8 +339,7 @@ void SALOMEDS_AttributeTableOfString::PutValue(const std::string& theValue, int CheckLocked(); SALOMEDS::Locker lock; try { - Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->PutValue((char*)theValue.c_str(), theRow, theColumn); + dynamic_cast(_local_impl)->PutValue(theValue, theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); @@ -398,7 +355,7 @@ bool SALOMEDS_AttributeTableOfString::HasValue(int theRow, int theColumn) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->HasValue(theRow, theColumn); + ret = dynamic_cast(_local_impl)->HasValue(theRow, theColumn); } else ret = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->HasValue(theRow, theColumn); return ret; @@ -410,8 +367,7 @@ std::string SALOMEDS_AttributeTableOfString::GetValue(int theRow, int theColumn) if (_isLocal) { SALOMEDS::Locker lock; try { - aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString):: - DownCast(_local_impl)->GetValue(theRow, theColumn)).ToCString(); + aValue = dynamic_cast(_local_impl)->GetValue(theRow, theColumn); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); @@ -429,10 +385,7 @@ std::vector SALOMEDS_AttributeTableOfString::GetRowSetIndices(int theRow) int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - 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)); + aVector = dynamic_cast(_local_impl)->GetSetRowIndices(theRow); } else { SALOMEDS::LongSeq_var aSet = @@ -447,7 +400,7 @@ void SALOMEDS_AttributeTableOfString::SetNbColumns(int theNbColumns) { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetNbColumns(theNbColumns); + dynamic_cast(_local_impl)->SetNbColumns(theNbColumns); } else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetNbColumns(theNbColumns); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx index 6f69a4284..614fc0f9e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeTableOfString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfString { public: - SALOMEDS_AttributeTableOfString(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr); + SALOMEDS_AttributeTableOfString(SALOMEDSImpl_AttributeTableOfString* theAttr); SALOMEDS_AttributeTableOfString(SALOMEDS::AttributeTableOfString_ptr theAttr); ~SALOMEDS_AttributeTableOfString(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx index b4d226e10..79ae23ecb 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx @@ -22,18 +22,12 @@ // Module : SALOME -#include -#include - #include "SALOMEDS_AttributeTableOfString_i.hxx" #include "SALOMEDS.hxx" -#include -#include -#include - #include #include +#include #include "Utils_ExceptHandlers.hxx" @@ -46,16 +40,16 @@ void SALOMEDS_AttributeTableOfString_i::SetTitle(const char* theTitle) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); CORBA::String_var aStr = CORBA::string_dup(theTitle); - aTable->SetTitle(TCollection_ExtendedString(aStr)); + aTable->SetTitle(string(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()); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); + CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str()); return c_s._retn(); } @@ -65,10 +59,10 @@ void SALOMEDS_AttributeTableOfString_i::SetRowTitle(CORBA::Long theIndex, const SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); + aTable->SetRowTitle(theIndex, string(theTitle)); } void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles) @@ -77,21 +71,21 @@ void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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())); + aTable->SetRowTitle(i + 1, string((char*)theTitles[i].in())); } } SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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()); + aTitles[i] =CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str()); return aTitles._retn(); } @@ -101,9 +95,9 @@ void SALOMEDS_AttributeTableOfString_i::SetColumnTitle(CORBA::Long theIndex, con SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - aTable->SetColumnTitle(theIndex, TCollection_ExtendedString((char*)theTitle)); + aTable->SetColumnTitle(theIndex, string((char*)theTitle)); } void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles) @@ -112,21 +106,21 @@ void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSe SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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())); + aTable->SetColumnTitle(i + 1, string((char*)theTitles[i].in())); } } SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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()); + aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str()); return aTitles._retn(); } @@ -137,9 +131,9 @@ void SALOMEDS_AttributeTableOfString_i::SetRowUnit(CORBA::Long theIndex, const c SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit)); + aTable->SetRowUnit(theIndex, string((char*)theUnit)); } void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits) @@ -148,21 +142,21 @@ void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& t SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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())); + aTable->SetRowUnit(i + 1, string((char*)theUnits[i].in())); } } SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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()); + aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str()); return aUnits._retn(); } @@ -170,13 +164,13 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits() CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbRows() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->GetNbRows(); + return dynamic_cast(_impl)->GetNbRows(); } CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbColumns() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->GetNbColumns(); + return dynamic_cast(_impl)->GetNbColumns(); } void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theData) @@ -185,10 +179,10 @@ void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theDat SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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]))); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(string(CORBA::string_dup(theData[i]))); aTable->SetRowData(aTable->GetNbRows() + 1, aRow); } @@ -198,10 +192,10 @@ void SALOMEDS_AttributeTableOfString_i::SetRow(CORBA::Long theRow, const SALOMED SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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]))); + vector aRow; + for (int i = 0; i < theData.length(); i++) aRow.push_back(string(CORBA::string_dup(theData[i].in()))); aTable->SetRowData(theRow, aRow); } @@ -210,14 +204,14 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRow(CORBA::Long theRo { SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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()); + vector aRow = aTable->GetRowData(theRow); + CorbaSeq->length(aRow.size()); + for (int i = 0; i < aRow.size(); i++) { + CorbaSeq[i] = CORBA::string_dup(aRow[i].c_str()); } return CorbaSeq._retn(); } @@ -228,10 +222,10 @@ void SALOMEDS_AttributeTableOfString_i::AddColumn(const SALOMEDS::StringSeq& the SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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]))); + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(string(CORBA::string_dup(theData[i]))); aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn); } @@ -241,10 +235,10 @@ void SALOMEDS_AttributeTableOfString_i::SetColumn(CORBA::Long theColumn, const S SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectArgumentLength); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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]))); + vector aColumn; + for (int i = 0; i < theData.length(); i++) aColumn.push_back(string(CORBA::string_dup(theData[i]))); aTable->SetColumnData(theColumn, aColumn); } @@ -253,14 +247,14 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumn(CORBA::Long th { SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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()); + vector aColumn = aTable->GetColumnData(theColumn); + CorbaSeq->length(aColumn.size()); + for (int i = 0; i < aColumn.size(); i++) { + CorbaSeq[i] = CORBA::string_dup(aColumn[i].c_str()); } return CorbaSeq._retn(); } @@ -271,7 +265,7 @@ void SALOMEDS_AttributeTableOfString_i::PutValue(const char* theValue, CORBA::Lo SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); CheckLocked(); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); char* aValue = CORBA::string_dup(theValue); aTable->PutValue(aValue, theRow, theColumn); @@ -280,7 +274,7 @@ void SALOMEDS_AttributeTableOfString_i::PutValue(const char* theValue, CORBA::Lo CORBA::Boolean SALOMEDS_AttributeTableOfString_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn) { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->HasValue(theRow, theColumn); + return dynamic_cast(_impl)->HasValue(theRow, theColumn); } char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn) @@ -288,34 +282,33 @@ char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Lon { SALOMEDS::Locker lock; Unexpect aCatch(ATS_IncorrectIndex); - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); - TCollection_AsciiString aValue; - + string aValue; try { aValue = aTable->GetValue(theRow, theColumn); } - catch(Standard_Failure) { + catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectIndex(); } - return CORBA::string_dup(aValue.ToCString()); + return CORBA::string_dup(aValue.c_str()); } SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Long theRow) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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); + vector aSeq = aTable->GetSetRowIndices(theRow); + CorbaSeq->length(aSeq.size()); + for (int i = 0; i < aSeq.size(); i++) { + CorbaSeq[i] = aSeq[i]; } return CorbaSeq._retn(); } @@ -324,29 +317,33 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Lo void SALOMEDS_AttributeTableOfString_i::SetNbColumns(CORBA::Long theNbColumns) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_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); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); - istrstream aStream((char*)&theStream[0], theStream.length()); - return aTable->RestoreFromString(aStream); + string aStream((char*)&theStream[0], theStream.length()); + aTable->Load(aStream); + return true; } SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfString_i::SaveToFile() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl); + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(_impl); + + string aString = aTable->Save(); + 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); - 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(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx index 340609304..b79de541f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeTableOfString_i: public virtual POA_SALOMEDS::AttributeT public: - SALOMEDS_AttributeTableOfString_i(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTableOfString_i(SALOMEDSImpl_AttributeTableOfString* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTableOfString_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx b/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx index fff0cb6f0..0c8be5bbe 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget.cxx @@ -24,13 +24,12 @@ #include "SALOMEDS_AttributeTarget.hxx" #include "SALOMEDS.hxx" -#include - #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDS_SObject.hxx" +using namespace std; -SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr) +SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(SALOMEDSImpl_AttributeTarget* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -47,7 +46,7 @@ void SALOMEDS_AttributeTarget::Add(const _PTR(SObject)& theObject) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Add(aSO->GetLocalImpl()); + dynamic_cast(_local_impl)->Add(*(aSO->GetLocalImpl())); } else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Add(aSO->GetCORBAImpl()); } @@ -60,11 +59,10 @@ std::vector<_PTR(SObject)> SALOMEDS_AttributeTarget::Get() if (_isLocal) { SALOMEDS::Locker lock; - 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))); + vector aSeq = dynamic_cast(_local_impl)->Get(); + aLength = aSeq.size(); + for (i = 0; i < aLength; i++) { + aSO = new SALOMEDS_SObject(aSeq[i]); aVector.push_back(_PTR(SObject)(aSO)); } } @@ -86,7 +84,7 @@ void SALOMEDS_AttributeTarget::Remove(const _PTR(SObject)& theObject) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Remove(aSO->GetLocalImpl()); + dynamic_cast(_local_impl)->Remove(*(aSO->GetLocalImpl())); } else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Remove(aSO->GetCORBAImpl()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx b/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx index 2634c8b0b..de006541f 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget.hxx @@ -38,7 +38,7 @@ class SALOMEDS_AttributeTarget: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTarget { public: - SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr); + SALOMEDS_AttributeTarget(SALOMEDSImpl_AttributeTarget* theAttr); SALOMEDS_AttributeTarget(SALOMEDS::AttributeTarget_ptr theAttr); ~SALOMEDS_AttributeTarget(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx index 42ced1f14..b4cc092ed 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.cxx @@ -27,30 +27,30 @@ #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDS.hxx" +#include "DF_Label.hxx" -#include +#include 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)); + DF_Label aLabel = DF_Label::Label(_impl->Label(), anObject->GetID(), 1); + dynamic_cast(_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(); + vector aSeq = dynamic_cast(_impl)->Get(); SALOMEDS::Study::ListOfSObject_var aSList = new SALOMEDS::Study::ListOfSObject; - int aLength = aSeq->Length(), i; + int aLength = aSeq.size(), 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; + for(i=0; i Label().Data(),anObject->GetID(),aLabel,1); - (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Remove(SALOMEDSImpl_Study::SObject(aLabel)); + DF_Label aLabel = DF_Label::Label(_impl->Label(), anObject->GetID(), 1); + dynamic_cast(_impl)->Remove(SALOMEDSImpl_Study::SObject(aLabel)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx index cb66abe3c..285c7eea6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTarget_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeTarget_i: public virtual POA_SALOMEDS::AttributeTarget, { public: - SALOMEDS_AttributeTarget_i(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTarget_i(SALOMEDSImpl_AttributeTarget* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTarget_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx index 9f9ebe762..e201c3eb4 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor.cxx @@ -24,10 +24,11 @@ #include "SALOMEDS_AttributeTextColor.hxx" #include "SALOMEDS.hxx" -#include +#include -SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor - (const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr) +using namespace std; + +SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor(SALOMEDSImpl_AttributeTextColor* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -44,11 +45,10 @@ STextColor SALOMEDS_AttributeTextColor::TextColor() STextColor aColor; if (_isLocal) { SALOMEDS::Locker lock; - 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); + vector aSeq = dynamic_cast(_local_impl)->TextColor(); + aColor.R = aSeq[0]; + aColor.G = aSeq[1]; + aColor.B = aSeq[2]; } else { SALOMEDS::Color anImplColor = SALOMEDS::AttributeTextColor::_narrow(_corba_impl)->TextColor(); @@ -64,11 +64,11 @@ void SALOMEDS_AttributeTextColor::SetTextColor(STextColor value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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); + vector aSeq; + aSeq.push_back( value.R ); + aSeq.push_back( value.G ); + aSeq.push_back( value.B ); + dynamic_cast(_local_impl)->ChangeArray(aSeq); } else { SALOMEDS::Color aColor; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx index 492322c02..0ea103376 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor.hxx @@ -39,7 +39,7 @@ class SALOMEDS_AttributeTextColor: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTextColor { public: - SALOMEDS_AttributeTextColor(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr); + SALOMEDS_AttributeTextColor(SALOMEDSImpl_AttributeTextColor* theAttr); SALOMEDS_AttributeTextColor(SALOMEDS::AttributeTextColor_ptr theAttr); ~SALOMEDS_AttributeTextColor(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx index f3ad1ce22..e8cab344c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.cxx @@ -24,7 +24,7 @@ #include "SALOMEDS_AttributeTextColor_i.hxx" #include "SALOMEDS.hxx" -#include +#include using namespace std; @@ -32,16 +32,16 @@ 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) { + vector anArray = dynamic_cast(_impl)->TextColor(); + if (anArray.size()!=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); + TextColor.R = anArray[0]; + TextColor.G = anArray[1]; + TextColor.B = anArray[2]; } return TextColor; } @@ -50,10 +50,10 @@ 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); + vector anArray; + anArray.push_back(value.R); + anArray.push_back(value.G); + anArray.push_back(value.B); + dynamic_cast(_impl)->ChangeArray(anArray); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx index 234f339c3..551e5b17d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextColor_i.hxx @@ -37,7 +37,7 @@ class SALOMEDS_AttributeTextColor_i: public virtual POA_SALOMEDS::AttributeTextC { public: - SALOMEDS_AttributeTextColor_i(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTextColor_i(SALOMEDSImpl_AttributeTextColor* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTextColor_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx index 04973fd57..2f1b8c803 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.cxx @@ -24,10 +24,12 @@ #include "SALOMEDS_AttributeTextHighlightColor.hxx" #include "SALOMEDS.hxx" -#include +#include + +using namespace std; SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor - (const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr) + (SALOMEDSImpl_AttributeTextHighlightColor* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -45,11 +47,10 @@ STextColor SALOMEDS_AttributeTextHighlightColor::TextHighlightColor() STextColor aColor; if (_isLocal) { SALOMEDS::Locker lock; - 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); + vector aSeq = dynamic_cast(_local_impl)->TextHighlightColor(); + aColor.R = aSeq[0]; + aColor.G = aSeq[1]; + aColor.B = aSeq[2]; } else { SALOMEDS::Color anImplColor = @@ -66,11 +67,11 @@ void SALOMEDS_AttributeTextHighlightColor::SetTextHighlightColor(STextColor valu if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - 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); + vector aSeq; + aSeq.push_back(value.R); + aSeq.push_back(value.G); + aSeq.push_back(value.B); + dynamic_cast(_local_impl)->ChangeArray(aSeq); } else { SALOMEDS::Color aColor; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx index 59ad88007..74980b9b7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor.hxx @@ -39,7 +39,7 @@ class SALOMEDS_AttributeTextHighlightColor: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTextHighlightColor { public: - SALOMEDS_AttributeTextHighlightColor(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr); + SALOMEDS_AttributeTextHighlightColor(SALOMEDSImpl_AttributeTextHighlightColor* theAttr); SALOMEDS_AttributeTextHighlightColor(SALOMEDS::AttributeTextHighlightColor_ptr theAttr); ~SALOMEDS_AttributeTextHighlightColor(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx index 55dca0ad2..8c72b38a6 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.cxx @@ -24,7 +24,7 @@ #include "SALOMEDS_AttributeTextHighlightColor_i.hxx" #include "SALOMEDS.hxx" -#include +#include using namespace std; @@ -32,16 +32,16 @@ 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) { + vector anArray = dynamic_cast(_impl)->TextHighlightColor(); + if (anArray.size()!=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); + TextHighlightColor.R = anArray[0]; + TextHighlightColor.G = anArray[1]; + TextHighlightColor.B = anArray[2]; } return TextHighlightColor; } @@ -50,9 +50,9 @@ void SALOMEDS_AttributeTextHighlightColor_i::SetTextHighlightColor(const SALOMED { 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); + vector anArray; + anArray.push_back(value.R); + anArray.push_back(value.G); + anArray.push_back(value.B); + dynamic_cast(_impl)->ChangeArray(anArray); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx index ec0aea995..9c7249f2b 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTextHighlightColor_i.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeTextHighlightColor_i: public virtual POA_SALOMEDS::Attri { public: - SALOMEDS_AttributeTextHighlightColor_i(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTextHighlightColor_i(SALOMEDSImpl_AttributeTextHighlightColor* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTextHighlightColor_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx index 8cac2063e..577e16811 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx @@ -27,16 +27,12 @@ #include #include -#include -#include -#include -#include -#include - #include "SALOMEDSImpl_AttributeTreeNode.hxx" #include "SALOMEDS_AttributeTreeNode.hxx" -SALOMEDS_AttributeTreeNode::SALOMEDS_AttributeTreeNode(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr) +using namespace std; + +SALOMEDS_AttributeTreeNode::SALOMEDS_AttributeTreeNode(SALOMEDSImpl_AttributeTreeNode* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -53,9 +49,9 @@ void SALOMEDS_AttributeTreeNode::SetFather(const _PTR(AttributeTreeNode)& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFather; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - aFather = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *aFather; + aNode = dynamic_cast(_local_impl); + aFather = dynamic_cast(aTN->_local_impl); aNode->SetFather(aFather); } else { @@ -70,8 +66,7 @@ bool SALOMEDS_AttributeTreeNode::HasFather() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); ret = aNode->HasFather(); } else { @@ -86,8 +81,7 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFather() SALOMEDSClient_AttributeTreeNode* aTN = NULL; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFather()); } else { @@ -103,9 +97,9 @@ void SALOMEDS_AttributeTreeNode::SetPrevious(const _PTR(AttributeTreeNode)& valu if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aPrev; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - aPrev = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *aPrev; + aNode = dynamic_cast(_local_impl); + aPrev = dynamic_cast(aTN->_local_impl); aNode->SetPrevious(aPrev); } else { @@ -120,8 +114,7 @@ bool SALOMEDS_AttributeTreeNode::HasPrevious() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); ret = aNode->HasPrevious(); } else { @@ -136,8 +129,7 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetPrevious() SALOMEDSClient_AttributeTreeNode* aTN = NULL; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); aTN = new SALOMEDS_AttributeTreeNode(aNode->GetPrevious()); } else { @@ -153,9 +145,9 @@ void SALOMEDS_AttributeTreeNode::SetNext(const _PTR(AttributeTreeNode)& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aNext; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - aNext = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *aNext; + aNode = dynamic_cast(_local_impl); + aNext = dynamic_cast(aTN->_local_impl); aNode->SetNext(aNext); } else { @@ -170,8 +162,7 @@ bool SALOMEDS_AttributeTreeNode::HasNext() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); ret = aNode->HasNext(); } else { @@ -186,8 +177,7 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetNext() SALOMEDSClient_AttributeTreeNode* aTN = NULL; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); aTN = new SALOMEDS_AttributeTreeNode(aNode->GetNext()); } else { @@ -203,9 +193,9 @@ void SALOMEDS_AttributeTreeNode::SetFirst(const _PTR(AttributeTreeNode)& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFirst; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - aFirst = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *aFirst; + aNode = dynamic_cast(_local_impl); + aFirst = dynamic_cast(aTN->_local_impl); aNode->SetFirst(aFirst); } else { @@ -220,8 +210,7 @@ bool SALOMEDS_AttributeTreeNode::HasFirst() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); ret = aNode->HasFirst(); } else { @@ -236,8 +225,7 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFirst() SALOMEDSClient_AttributeTreeNode* aTN = NULL; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFirst()); } else { @@ -249,14 +237,11 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFirst() void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value) { - if(!Standard_GUID::CheckGUIDFormat((char*)value.c_str())) throw invalid_argument("Invalid GUID"); - if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - aNode->SetTreeID(Standard_GUID((char*)value.c_str())); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); + aNode->SetTreeID(value); } else { SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); @@ -266,21 +251,18 @@ void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value) std::string SALOMEDS_AttributeTreeNode::GetTreeID() { - TCollection_AsciiString aGUID; + string aGUID; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - char guid[40]; - aNode->GetTreeID().ToCString(guid); - aGUID = TCollection_AsciiString(guid); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_local_impl); + aGUID = aNode->GetTreeID(); } else { SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl); - aGUID = TCollection_AsciiString(aNode->GetTreeID()); + aGUID = aNode->GetTreeID(); } - return std::string(aGUID.ToCString()); + return aGUID; } void SALOMEDS_AttributeTreeNode::Append(const _PTR(AttributeTreeNode)& value) @@ -289,9 +271,9 @@ void SALOMEDS_AttributeTreeNode::Append(const _PTR(AttributeTreeNode)& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); aNode->Append(anOther); } else { @@ -307,9 +289,9 @@ void SALOMEDS_AttributeTreeNode::Prepend(const _PTR(AttributeTreeNode)& value) if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); aNode->Prepend(anOther); } else { @@ -325,9 +307,9 @@ void SALOMEDS_AttributeTreeNode::InsertBefore(const _PTR(AttributeTreeNode)& val if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); aNode->InsertBefore(anOther); } else { @@ -343,9 +325,9 @@ void SALOMEDS_AttributeTreeNode::InsertAfter(const _PTR(AttributeTreeNode)& valu if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); aNode->InsertAfter(anOther); } else { @@ -360,7 +342,7 @@ void SALOMEDS_AttributeTreeNode::Remove() if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Remove(); + dynamic_cast(_local_impl)->Remove(); } else SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Remove(); } @@ -370,7 +352,7 @@ int SALOMEDS_AttributeTreeNode::Depth() int aDepth; if (_isLocal) { SALOMEDS::Locker lock; - aDepth = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Depth(); + aDepth = dynamic_cast(_local_impl)->Depth(); } else aDepth = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Depth(); return aDepth; @@ -381,7 +363,7 @@ bool SALOMEDS_AttributeTreeNode::IsRoot() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->IsRoot(); + ret = dynamic_cast(_local_impl)->IsRoot(); } else ret = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->IsRoot(); return ret; @@ -393,9 +375,9 @@ bool SALOMEDS_AttributeTreeNode::IsDescendant(const _PTR(AttributeTreeNode)& val SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value.get()); if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); ret = aNode->IsDescendant(anOther); } else { @@ -412,9 +394,9 @@ bool SALOMEDS_AttributeTreeNode::IsFather(const _PTR(AttributeTreeNode)& value) SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value.get()); if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); ret = aNode->IsFather(anOther); } else { @@ -431,9 +413,9 @@ bool SALOMEDS_AttributeTreeNode::IsChild(const _PTR(AttributeTreeNode)& value) SALOMEDS_AttributeTreeNode* aTN = dynamic_cast(value.get()); if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther; - aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl); - anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl); + SALOMEDSImpl_AttributeTreeNode *aNode, *anOther; + aNode = dynamic_cast(_local_impl); + anOther = dynamic_cast(aTN->_local_impl); ret = aNode->IsChild(anOther); } else { @@ -449,9 +431,7 @@ std::string SALOMEDS_AttributeTreeNode::Label() string aLabel; if (_isLocal) { SALOMEDS::Locker lock; - TCollection_AsciiString anAsciiLabel; - TDF_Tool::Entry(_local_impl->Label(), anAsciiLabel); - aLabel = std::string(anAsciiLabel.ToCString()); + aLabel = _local_impl->Label().Entry(); } else aLabel = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Label(); return aLabel; diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx index 8e67491e3..c6ded0967 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeTreeNode: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTreeNode { public: - SALOMEDS_AttributeTreeNode(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr); + SALOMEDS_AttributeTreeNode(SALOMEDSImpl_AttributeTreeNode* theAttr); SALOMEDS_AttributeTreeNode(SALOMEDS::AttributeTreeNode_ptr theAttr); ~SALOMEDS_AttributeTreeNode(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx index 3574d218b..41e69b8a7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx @@ -25,26 +25,20 @@ #include "SALOMEDS_AttributeTreeNode_i.hxx" #include "utilities.h" #include "SALOMEDS.hxx" -#include -#include -#include -#include using namespace std; -static Handle(SALOMEDSImpl_AttributeTreeNode) GetNode(SALOMEDS::AttributeTreeNode_ptr value, - const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode) +static SALOMEDSImpl_AttributeTreeNode* GetNode(SALOMEDS::AttributeTreeNode_ptr value, + 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); + SALOMEDSImpl_AttributeTreeNode* aResult = NULL; + DF_Label aLabel = DF_Label::Label(aNode->Label(), value->Label()); 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)) { + if (!(aResult=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(aNode->ID()))) { MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute") MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute") } @@ -55,21 +49,21 @@ void SALOMEDS_AttributeTreeNode_i::SetFather(SALOMEDS::AttributeTreeNode_ptr val { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetFather(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFather() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFather(); + return dynamic_cast(_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); + aFather = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetFather(), _orb); #ifndef WNT return aFather->POA_SALOMEDS::AttributeTreeNode::_this(); #else @@ -81,21 +75,21 @@ void SALOMEDS_AttributeTreeNode_i::SetPrevious(SALOMEDS::AttributeTreeNode_ptr v { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetPrevious(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasPrevious() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasPrevious(); + return dynamic_cast(_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); + aPrevious=new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetPrevious(), _orb); #ifndef WNT return aPrevious->POA_SALOMEDS::AttributeTreeNode::_this(); #else @@ -107,21 +101,21 @@ void SALOMEDS_AttributeTreeNode_i::SetNext(SALOMEDS::AttributeTreeNode_ptr value { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetNext(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasNext() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasNext(); + return dynamic_cast(_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); + aNext = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetNext(), _orb); #ifndef WNT return aNext->POA_SALOMEDS::AttributeTreeNode::_this(); #else @@ -133,21 +127,21 @@ void SALOMEDS_AttributeTreeNode_i::SetFirst(SALOMEDS::AttributeTreeNode_ptr valu { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetFirst(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFirst() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFirst(); + return dynamic_cast(_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); + aFirst = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetFirst(), _orb); #ifndef WNT return aFirst->POA_SALOMEDS::AttributeTreeNode::_this(); #else @@ -159,24 +153,22 @@ 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((char*)value)); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); + aNode->SetTreeID(value); } 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(); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); + return CORBA::String_var(CORBA::string_dup(aNode->ID().c_str()))._retn(); } void SALOMEDS_AttributeTreeNode_i::Append(SALOMEDS::AttributeTreeNode_ptr value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->Append(GetNode(value, aNode)); } @@ -184,7 +176,7 @@ void SALOMEDS_AttributeTreeNode_i::Prepend(SALOMEDS::AttributeTreeNode_ptr value { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->Prepend(GetNode(value, aNode)); } @@ -192,7 +184,7 @@ void SALOMEDS_AttributeTreeNode_i::InsertBefore(SALOMEDS::AttributeTreeNode_ptr { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->InsertBefore(GetNode(value, aNode)); } @@ -200,7 +192,7 @@ void SALOMEDS_AttributeTreeNode_i::InsertAfter(SALOMEDS::AttributeTreeNode_ptr v { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->InsertAfter(GetNode(value, aNode)); } @@ -208,50 +200,48 @@ void SALOMEDS_AttributeTreeNode_i::Remove() { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->Remove(); } CORBA::Long SALOMEDS_AttributeTreeNode_i::Depth() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->Depth(); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsRoot() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_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); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_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); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_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); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_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(); + return CORBA::String_var(CORBA::string_dup(_impl->Label().Entry().c_str()))._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx index e827dea01..e796d30f2 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.hxx @@ -35,7 +35,7 @@ class SALOMEDS_AttributeTreeNode_i: public virtual POA_SALOMEDS::AttributeTreeNo public virtual SALOMEDS_GenericAttribute_i { public: - SALOMEDS_AttributeTreeNode_i(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr, CORBA::ORB_ptr orb) + SALOMEDS_AttributeTreeNode_i(SALOMEDSImpl_AttributeTreeNode* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeTreeNode_i() {}; diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx index c20087a47..804f4b148 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx @@ -27,11 +27,7 @@ #include #include -#include -#include -#include - -SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr) +SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(SALOMEDSImpl_AttributeUserID* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -48,8 +44,7 @@ std::string SALOMEDS_AttributeUserID::Value() if (_isLocal) { SALOMEDS::Locker lock; char guid[40]; - Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_local_impl)->Value().ToCString(guid); - aValue = std::string(guid); + aValue = dynamic_cast(_local_impl)->Value(); } else aValue = SALOMEDS::AttributeUserID::_narrow(_corba_impl)->Value(); return aValue; @@ -57,13 +52,10 @@ std::string SALOMEDS_AttributeUserID::Value() void SALOMEDS_AttributeUserID::SetValue(const std::string& value) { - if(!Standard_GUID::CheckGUIDFormat((char*)value.c_str())) throw invalid_argument("Invalid GUID"); - if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeUserID):: - DownCast(_local_impl)->SetValue(Standard_GUID((char*)value.c_str())); + dynamic_cast(_local_impl)->SetValue(value); } else SALOMEDS::AttributeUserID::_narrow(_corba_impl)->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx b/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx index 475d5918b..0dfaa9b68 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID.hxx @@ -36,7 +36,7 @@ class SALOMEDS_AttributeUserID: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeUserID { public: - SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr); + SALOMEDS_AttributeUserID(SALOMEDSImpl_AttributeUserID* theAttr); SALOMEDS_AttributeUserID(SALOMEDS::AttributeUserID_ptr theAttr); ~SALOMEDS_AttributeUserID(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx index be52901b6..2165d0e55 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.cxx @@ -24,16 +24,13 @@ #include "SALOMEDS_AttributeUserID_i.hxx" #include "SALOMEDS.hxx" -#include 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); + CORBA::String_var c_s = CORBA::string_dup(dynamic_cast(_impl)->ID().c_str()); return c_s._retn(); } @@ -42,6 +39,6 @@ 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))); + dynamic_cast(_impl)->SetValue(string(Str)); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx index ee4b82bee..14e409e99 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID_i.hxx @@ -35,7 +35,7 @@ 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_AttributeUserID_i(SALOMEDSImpl_AttributeUserID* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; ~SALOMEDS_AttributeUserID_i() {}; @@ -43,7 +43,7 @@ public: char* Value(); void SetValue(const char* value); - static const Standard_GUID& DefaultID() { + static const std::string& DefaultID() { return SALOMEDSImpl_AttributeUserID::DefaultID(); } diff --git a/src/SALOMEDS/SALOMEDS_Attributes.hxx b/src/SALOMEDS/SALOMEDS_Attributes.hxx index 4c9901729..7ccfc0243 100644 --- a/src/SALOMEDS/SALOMEDS_Attributes.hxx +++ b/src/SALOMEDS/SALOMEDS_Attributes.hxx @@ -90,7 +90,7 @@ #include "SALOMEDS_AttributeString_i.hxx" #define __CreateCORBAAttribute(CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \ - Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theAttr); \ + SALOMEDSImpl_##CORBA_Name* A = dynamic_cast(theAttr); \ SALOMEDS_##CORBA_Name##_i* Attr = new SALOMEDS_##CORBA_Name##_i(A, theOrb); \ attr_servant = Attr; \ anAttribute = Attr->CORBA_Name::_this(); \ diff --git a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx index f333e668b..74dd4e85d 100644 --- a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx @@ -34,7 +34,7 @@ using namespace std; * Purpose : */ //============================================================================ -void SALOMEDS_BasicAttribute_i::SetLabel(const TDF_Label Lab) +void SALOMEDS_BasicAttribute_i::SetLabel(const DF_Label& Lab) { _Lab = Lab; } diff --git a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx index 26455a9f3..b8902a902 100644 --- a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx @@ -32,12 +32,12 @@ // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) -#include +#include class SALOMEDS_BasicAttribute_i: public POA_SALOMEDS::BasicAttribute, public PortableServer::ServantBase { protected: - TDF_Label _Lab; + DF_Label _Lab; public: SALOMEDS_BasicAttribute_i() {}; @@ -47,7 +47,7 @@ public: virtual char * Save() =0; virtual void Load () =0; CORBA::Boolean GetPtr(SALOMEDS::SObject so); - void SetLabel(const TDF_Label Lab); + void SetLabel(const DF_Label& Lab); virtual char* GetType() = 0; }; diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx index 0f7bf02cc..954f83f5b 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx @@ -29,25 +29,25 @@ using namespace std; -SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator) +SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(const SALOMEDSImpl_ChildIterator& theIterator) { SALOMEDS::Locker lock; _isLocal = true; - _local_impl = theIterator; + _local_impl = theIterator.GetPersistentCopy(); _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(); + else if(_local_impl) delete _local_impl; } void SALOMEDS_ChildIterator::Init() @@ -70,7 +70,7 @@ void SALOMEDS_ChildIterator::InitEx(bool theAllLevels) bool SALOMEDS_ChildIterator::More() { - bool ret; + bool ret = false; if (_isLocal) { SALOMEDS::Locker lock; ret = _local_impl->More(); diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.hxx b/src/SALOMEDS/SALOMEDS_ChildIterator.hxx index 4c306e105..e2129d695 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator.hxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.hxx @@ -35,12 +35,12 @@ class SALOMEDS_ChildIterator: public SALOMEDSClient_ChildIterator { private: bool _isLocal; - Handle(SALOMEDSImpl_ChildIterator) _local_impl; + SALOMEDSImpl_ChildIterator* _local_impl; SALOMEDS::ChildIterator_var _corba_impl; public: - SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator); + SALOMEDS_ChildIterator(const SALOMEDSImpl_ChildIterator& theIterator); SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator); ~SALOMEDS_ChildIterator(); diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx index 305b51110..7278ab8bd 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx @@ -36,9 +36,9 @@ using namespace std; * Purpose : */ //============================================================================ -SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const Handle(SALOMEDSImpl_ChildIterator)& theImpl, +SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const SALOMEDSImpl_ChildIterator& theImpl, CORBA::ORB_ptr orb) - : _it(theImpl) + : _it(theImpl.GetPersistentCopy()) { SALOMEDS::Locker lock; _orb = CORBA::ORB::_duplicate(orb); @@ -51,6 +51,7 @@ SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const Handle(SALOMEDSImpl_Chi //============================================================================ SALOMEDS_ChildIterator_i::~SALOMEDS_ChildIterator_i() { + if(_it) delete _it; } //============================================================================ @@ -107,7 +108,7 @@ void SALOMEDS_ChildIterator_i::Next() SALOMEDS::SObject_ptr SALOMEDS_ChildIterator_i::Value() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _it->Value(); + SALOMEDSImpl_SObject aSO = _it->Value(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx index d2af3944d..be5906142 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx @@ -42,11 +42,11 @@ class SALOMEDS_ChildIterator_i: public virtual POA_SALOMEDS::ChildIterator, { private: CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_ChildIterator) _it; + SALOMEDSImpl_ChildIterator* _it; public: //! standard constructor - SALOMEDS_ChildIterator_i(const Handle(SALOMEDSImpl_ChildIterator)&, CORBA::ORB_ptr); + SALOMEDS_ChildIterator_i(const SALOMEDSImpl_ChildIterator&, CORBA::ORB_ptr); //! standard destructor ~SALOMEDS_ChildIterator_i(); diff --git a/src/SALOMEDS/SALOMEDS_Client.cxx b/src/SALOMEDS/SALOMEDS_Client.cxx index c100e8975..cc76b69e0 100644 --- a/src/SALOMEDS/SALOMEDS_Client.cxx +++ b/src/SALOMEDS/SALOMEDS_Client.cxx @@ -40,7 +40,7 @@ using namespace std; * Purpose : */ //============================================================================ -static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO,Standard_Integer offset) { +static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO, int offset) { SALOMEDS::SObject_var RefSO; SALOMEDS::ChildIterator_var it = Study->NewChildIterator(SO); for (; it->More();it->Next()){ @@ -50,12 +50,12 @@ static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO,Sta { SALOMEDS::AttributeName_var Name = SALOMEDS::AttributeName::_narrow(anAttr); CORBA::String_var Val = Name->Value(); - for (Standard_Integer i = 1; i <= offset ; i++) + for (int i = 1; i <= offset ; i++) MESSAGE("--"); MESSAGE(">"<GetID()<ReferencedObject(RefSO)) { - for (Standard_Integer i = 1; i <= offset ; i++) + for (int i = 1; i <= offset ; i++) MESSAGE(" "); MESSAGE("*Reference"<GetID()); } @@ -71,9 +71,9 @@ static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO,Sta static void DumpStudy (SALOMEDS::Study_ptr Study) { MESSAGE("Explore Study and Write name of each object if it exists"); - Standard_CString name; + char* name; SALOMEDS::SComponentIterator_var itcomp = Study->NewComponentIterator(); - Standard_Integer offset = 1; + int offset = 1; for (; itcomp->More(); itcomp->Next()) { SALOMEDS::SComponent_var SC = itcomp->Value(); name = SC->ComponentDataType(); @@ -90,7 +90,7 @@ static void DumpStudy (SALOMEDS::Study_ptr Study) { static void Test(SALOMEDS::StudyManager_ptr myStudyMgr ) { try { - Standard_CString name; + char* name; MESSAGE("Create New Study Study1"); SALOMEDS::Study_var myStudy = myStudyMgr->NewStudy("Study1"); @@ -282,11 +282,9 @@ int main(int argc, char** argv) try { // Initialise the ORB. #if OMNIORB_VERSION >= 4 - const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } }; - CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ; + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ; #else - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3"); - omniORB::MaxMessageSize(100 * 1024 * 1024); + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" ); #endif // Obtain a reference to the root POA. diff --git a/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx index cb6786209..fd5307fa6 100644 --- a/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx +++ b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx @@ -91,7 +91,7 @@ #include "SALOMEDS_AttributeString.hxx" #define __CreateClientAttributeLocal(CORBA_Name) if (strcmp(aTypeOfAttribute.c_str(), #CORBA_Name) == 0) { \ - Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theGA); \ + SALOMEDSImpl_##CORBA_Name* A = dynamic_cast(theGA); \ aGA = new SALOMEDS_##CORBA_Name(A); \ } diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx deleted file mode 100644 index 105af6e7a..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx +++ /dev/null @@ -1,95 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile -#define _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile - -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TColStd_MapIntegerHasher; -class SALOMEDS_DataMapOfIntegerString; -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString : public TCollection_BasicMapIterator { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapOfIntegerString(); -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapOfIntegerString(const SALOMEDS_DataMapOfIntegerString& aMap); -Standard_EXPORT void Initialize(const SALOMEDS_DataMapOfIntegerString& aMap) ; -Standard_EXPORT const Standard_Real& Key() const; -Standard_EXPORT const TCollection_ExtendedString& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx deleted file mode 100644 index 2cef58755..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -using namespace std; - - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx deleted file mode 100644 index 7e62aa311..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx +++ /dev/null @@ -1,114 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile -#define _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile - -#ifndef _TCollection_BasicMapIterator_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include -#endif -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TDF_Label; -class SALOMEDS_DataMapStringLabel; -class SALOMEDS_DataMapNodeOfDataMapStringLabel; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapIteratorOfDataMapStringLabel : public TCollection_BasicMapIterator { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapStringLabel(); -Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapStringLabel(const SALOMEDS_DataMapStringLabel& aMap); -Standard_EXPORT void Initialize(const SALOMEDS_DataMapStringLabel& aMap) ; -Standard_EXPORT const TCollection_ExtendedString& Key() const; -Standard_EXPORT const TDF_Label& Value() const; - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx deleted file mode 100644 index 4f69f1d72..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" - -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapStringLabel.hxx" -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#endif - using namespace std; - - -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx deleted file mode 100644 index 1ab360dd7..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx +++ /dev/null @@ -1,132 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#define _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif - -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class TCollection_ExtendedString; -class TColStd_MapIntegerHasher; -class SALOMEDS_DataMapOfIntegerString; -class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString; - - -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString : public TCollection_MapNode { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -SALOMEDS_DataMapNodeOfDataMapOfIntegerString(const Standard_Real& K,const TCollection_ExtendedString& I,const TCollection_MapNodePtr& n); - Standard_Real& Key() const; - TCollection_ExtendedString& Value() const; -Standard_EXPORT ~SALOMEDS_DataMapNodeOfDataMapOfIntegerString(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myKey; -TCollection_ExtendedString myValue; - - -}; - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx deleted file mode 100644 index a48b6d9d7..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile -#include -#endif -using namespace std; -SALOMEDS_DataMapNodeOfDataMapOfIntegerString::~SALOMEDS_DataMapNodeOfDataMapOfIntegerString() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DataMapNodeOfDataMapOfIntegerString", - sizeof(SALOMEDS_DataMapNodeOfDataMapOfIntegerString), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString))) { - _anOtherObject = Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)((Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_DataMapNodeOfDataMapOfIntegerString::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) ; -} -Standard_Boolean SALOMEDS_DataMapNodeOfDataMapOfIntegerString::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) == AType || TCollection_MapNode::IsKind(AType)); -} -Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString::~Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString() {} -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx deleted file mode 100644 index a12d64706..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx +++ /dev/null @@ -1,154 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#define _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include -#endif - -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_MapNode_HeaderFile -#include -#endif -#ifndef _TCollection_MapNodePtr_HeaderFile -#include -#endif -class TCollection_ExtendedString; -class TDF_Label; -class SALOMEDS_DataMapStringLabel; -class SALOMEDS_DataMapIteratorOfDataMapStringLabel; - - -class SALOMEDS_DataMapNodeOfDataMapStringLabel : public TCollection_MapNode { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT inline SALOMEDS_DataMapNodeOfDataMapStringLabel(const TCollection_ExtendedString& K,const TDF_Label& I,const TCollection_MapNodePtr& n); -Standard_EXPORT inline TCollection_ExtendedString& Key() const; -Standard_EXPORT inline TDF_Label& Value() const; -Standard_EXPORT ~SALOMEDS_DataMapNodeOfDataMapStringLabel(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TCollection_ExtendedString myKey; -TDF_Label myValue; - - -}; - -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" - -#include - -#undef TheKey -#undef TheKey_hxx -#undef TheItem -#undef TheItem_hxx -#undef Hasher -#undef Hasher_hxx -#undef TCollection_DataMapNode -#undef TCollection_DataMapNode_hxx -#undef TCollection_DataMapIterator -#undef TCollection_DataMapIterator_hxx -#undef Handle_TCollection_DataMapNode -#undef TCollection_DataMapNode_Type_ -#undef TCollection_DataMap -#undef TCollection_DataMap_hxx - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx deleted file mode 100644 index e0364db6b..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapStringLabel.hxx" -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#endif -using namespace std; -SALOMEDS_DataMapNodeOfDataMapStringLabel::~SALOMEDS_DataMapNodeOfDataMapStringLabel() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DataMapNodeOfDataMapStringLabel", - sizeof(SALOMEDS_DataMapNodeOfDataMapStringLabel), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel))) { - _anOtherObject = Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)((Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_DataMapNodeOfDataMapStringLabel::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel) ; -} -Standard_Boolean SALOMEDS_DataMapNodeOfDataMapStringLabel::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel) == AType || TCollection_MapNode::IsKind(AType)); -} -Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel::~Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel() {} -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx b/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx deleted file mode 100644 index 8d04e8c82..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapOfIntegerString.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#define _SALOMEDS_DataMapOfIntegerString_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TColStd_MapIntegerHasher; -class SALOMEDS_DataMapNodeOfDataMapOfIntegerString; -class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapOfIntegerString : public TCollection_BasicMap { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapOfIntegerString(const Standard_Integer NbBuckets = 1); -Standard_EXPORT SALOMEDS_DataMapOfIntegerString& Assign(const SALOMEDS_DataMapOfIntegerString& Other) ; - SALOMEDS_DataMapOfIntegerString& operator =(const SALOMEDS_DataMapOfIntegerString& Other) -{ - return Assign(Other); -} - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; -Standard_EXPORT void Clear() ; -~SALOMEDS_DataMapOfIntegerString() -{ - Clear(); -} - -Standard_EXPORT Standard_Boolean Bind(const Standard_Real& K,const TCollection_ExtendedString& I) ; -Standard_EXPORT Standard_Boolean IsBound(const Standard_Real& K) const; -Standard_EXPORT Standard_Boolean UnBind(const Standard_Real& K) ; -Standard_EXPORT const TCollection_ExtendedString& Find(const Standard_Real& K) const; - const TCollection_ExtendedString& operator()(const Standard_Real& K) const -{ - return Find(K); -} - -Standard_EXPORT TCollection_ExtendedString& ChangeFind(const Standard_Real& K) ; - TCollection_ExtendedString& operator()(const Standard_Real& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // -Standard_EXPORT SALOMEDS_DataMapOfIntegerString(const SALOMEDS_DataMapOfIntegerString& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx deleted file mode 100644 index 829ebac7c..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapOfIntegerString_0.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_DataMapOfIntegerString_0.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_MapIntegerHasher_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile -#include -#endif - using namespace std; - - -#define TheKey Standard_Real -#define TheKey_hxx -#define TheItem TCollection_ExtendedString -#define TheItem_hxx -#define Hasher TColStd_MapIntegerHasher -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_hxx -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString -#define TCollection_DataMapIterator_hxx -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_() -#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString -#define TCollection_DataMap_hxx -#include - diff --git a/src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx b/src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx deleted file mode 100644 index ea00dc5f5..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapStringLabel.hxx +++ /dev/null @@ -1,146 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DataMapStringLabel.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile -#define _SALOMEDS_DataMapStringLabel_HeaderFile - -#ifndef _TCollection_BasicMap_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -class Standard_DomainError; -class Standard_NoSuchObject; -class TCollection_ExtendedString; -class TDF_Label; -class SALOMEDS_DataMapNodeOfDataMapStringLabel; -class SALOMEDS_DataMapIteratorOfDataMapStringLabel; - - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class SALOMEDS_DataMapStringLabel : public TCollection_BasicMap { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_DataMapStringLabel(const Standard_Integer NbBuckets = 1); -Standard_EXPORT SALOMEDS_DataMapStringLabel& Assign(const SALOMEDS_DataMapStringLabel& Other) ; - SALOMEDS_DataMapStringLabel& operator =(const SALOMEDS_DataMapStringLabel& Other) -{ - return Assign(Other); -} - -Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; -Standard_EXPORT void Clear() ; -~SALOMEDS_DataMapStringLabel() -{ - Clear(); -} - -Standard_EXPORT Standard_Boolean Bind(const TCollection_ExtendedString& K,const TDF_Label& I) ; -Standard_EXPORT Standard_Boolean IsBound(const TCollection_ExtendedString& K) const; -Standard_EXPORT Standard_Boolean UnBind(const TCollection_ExtendedString& K) ; -Standard_EXPORT const TDF_Label& Find(const TCollection_ExtendedString& K) const; - const TDF_Label& operator()(const TCollection_ExtendedString& K) const -{ - return Find(K); -} - -Standard_EXPORT TDF_Label& ChangeFind(const TCollection_ExtendedString& K) ; - TDF_Label& operator()(const TCollection_ExtendedString& K) -{ - return ChangeFind(K); -} - - - - - - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // -Standard_EXPORT SALOMEDS_DataMapStringLabel(const SALOMEDS_DataMapStringLabel& Other); - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx b/src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx deleted file mode 100644 index b54d46130..000000000 --- a/src/SALOMEDS/SALOMEDS_DataMapStringLabel_0.cxx +++ /dev/null @@ -1,67 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DataMapStringLabel_0.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DataMapStringLabel.hxx" - -#ifndef _Standard_DomainError_HeaderFile -#include -#endif -#ifndef _Standard_NoSuchObject_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#endif -#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile -#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#endif - using namespace std; - - -#define TheKey TCollection_ExtendedString -#define TheKey_hxx -#define TheItem TDF_Label -#define TheItem_hxx -#define Hasher TCollection_ExtendedString -#define Hasher_hxx -#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx" -#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel -#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx" -#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel -#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_() -#define TCollection_DataMap SALOMEDS_DataMapStringLabel -#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx" -#include - diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl b/src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl deleted file mode 100644 index 6cc4eda58..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx deleted file mode 100644 index 458c2e615..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DrawableAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DrawableAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_DrawableAttribute::GetID () -{ - static Standard_GUID SALOMEDS_DrawableAttributeID ("12837184-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_DrawableAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_DrawableAttribute) SALOMEDS_DrawableAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_DrawableAttribute) A; - if (!L.FindAttribute(SALOMEDS_DrawableAttribute::GetID(),A)) { - A = new SALOMEDS_DrawableAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_DrawableAttribute::SALOMEDS_DrawableAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_DrawableAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_DrawableAttribute::NewEmpty () const -{ - return new SALOMEDS_DrawableAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_DrawableAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_DrawableAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx deleted file mode 100644 index 077626a87..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DrawableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_DrawableAttribute_HeaderFile -#define _SALOMEDS_DrawableAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_DrawableAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_DrawableAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_DrawableAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_DrawableAttribute(); -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 ~SALOMEDS_DrawableAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DrawableAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx deleted file mode 100644 index 26ede15f1..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DrawableAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_DrawableAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_DrawableAttribute::~SALOMEDS_DrawableAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_DrawableAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DrawableAttribute", - sizeof(SALOMEDS_DrawableAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_DrawableAttribute) Handle(SALOMEDS_DrawableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_DrawableAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DrawableAttribute))) { - _anOtherObject = Handle(SALOMEDS_DrawableAttribute)((Handle(SALOMEDS_DrawableAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_DrawableAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_DrawableAttribute) ; -} -Standard_Boolean SALOMEDS_DrawableAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_DrawableAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_DrawableAttribute::~Handle_SALOMEDS_DrawableAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx b/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx deleted file mode 100644 index c7c9b6bf0..000000000 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_DrawableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_DrawableAttribute_HeaderFile -#include "SALOMEDS_DrawableAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.cxx b/src/SALOMEDS/SALOMEDS_Driver_i.cxx index d03caa15f..5c1d2344c 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.cxx @@ -34,48 +34,48 @@ SALOMEDS_Driver_i::~SALOMEDS_Driver_i() { } -Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::Save(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile) +SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::Save(const SALOMEDSImpl_SComponent& theComponent, + const string& theURL, + long& theStreamLength, + bool isMultiFile) { SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); - CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + CORBA::String_var url = CORBA::string_dup(theURL.c_str()); SALOMEDS::unlock(); SALOMEDS::TMPFile_var aStream = _driver->Save(sco.in(), url, isMultiFile); - Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn())); + SALOMEDSImpl_TMPFile* aTMPFile = new SALOMEDS_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); SALOMEDS::lock(); return aTMPFile; } -Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile) +SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::SaveASCII(const SALOMEDSImpl_SComponent& theComponent, + const string& theURL, + long& theStreamLength, + bool isMultiFile) { SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); - CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + CORBA::String_var url = CORBA::string_dup(theURL.c_str()); SALOMEDS::unlock(); SALOMEDS::TMPFile_var aStream = _driver->SaveASCII(sco.in(), url, isMultiFile); - Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn())); + SALOMEDSImpl_TMPFile* aTMPFile = new SALOMEDS_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); SALOMEDS::lock(); return aTMPFile; } -bool SALOMEDS_Driver_i::Load(const Handle(SALOMEDSImpl_SComponent)& theComponent, +bool SALOMEDS_Driver_i::Load(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const string& theURL, bool isMultiFile) { SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); - CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + CORBA::String_var url = CORBA::string_dup(theURL.c_str()); CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; SALOMEDS::TMPFile_var aStream; @@ -91,14 +91,14 @@ bool SALOMEDS_Driver_i::Load(const Handle(SALOMEDSImpl_SComponent)& theComponent return isOk; } -bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, +bool SALOMEDS_Driver_i::LoadASCII(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const string& theURL, bool isMultiFile) { SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); - CORBA::String_var url = CORBA::string_dup(theURL.ToCString()); + CORBA::String_var url = CORBA::string_dup(theURL.c_str()); CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; SALOMEDS::TMPFile_var aStream; @@ -114,7 +114,7 @@ bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComp return isOk; } -void SALOMEDS_Driver_i::Close(const Handle(SALOMEDSImpl_SComponent)& theComponent) +void SALOMEDS_Driver_i::Close(const SALOMEDSImpl_SComponent& theComponent) { SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); @@ -125,36 +125,36 @@ void SALOMEDS_Driver_i::Close(const Handle(SALOMEDSImpl_SComponent)& theComponen -TCollection_AsciiString SALOMEDS_Driver_i::IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject, - const TCollection_AsciiString& IORString, - bool isMultiFile, - bool isASCII) +string SALOMEDS_Driver_i::IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject, + const string& IORString, + bool isMultiFile, + bool isASCII) { SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theSObject, _orb); - CORBA::String_var ior = CORBA::string_dup(IORString.ToCString()); + CORBA::String_var ior = CORBA::string_dup(IORString.c_str()); SALOMEDS::unlock(); CORBA::String_var pers_string =_driver->IORToLocalPersistentID(so.in(), ior.in(), isMultiFile, isASCII); SALOMEDS::lock(); - return TCollection_AsciiString(pers_string); + return string(pers_string); } -TCollection_AsciiString SALOMEDS_Driver_i::LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theObject, - const TCollection_AsciiString& aLocalPersistentID, - bool isMultiFile, - bool isASCII) +string SALOMEDS_Driver_i::LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theObject, + const string& 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()); + CORBA::String_var pers_string = CORBA::string_dup(aLocalPersistentID.c_str()); SALOMEDS::unlock(); CORBA::String_var IOR = _driver->LocalPersistentIDToIOR(so.in(), pers_string.in(), isMultiFile, isASCII); SALOMEDS::lock(); - return TCollection_AsciiString(IOR); + return string(IOR); } -bool SALOMEDS_Driver_i::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDS_Driver_i::CanCopy(const SALOMEDSImpl_SObject& theObject) { SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb); @@ -166,16 +166,16 @@ bool SALOMEDS_Driver_i::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) } -Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, - int& theObjectID, - long& theStreamLength) +SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::CopyFrom(const SALOMEDSImpl_SObject& theObject, + int& theObjectID, + long& theStreamLength) { SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb); SALOMEDS::unlock(); CORBA::Long anObjectID; SALOMEDS::TMPFile_var aStream = _driver->CopyFrom(so.in(), anObjectID); - Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn())); + SALOMEDSImpl_TMPFile* aTMPFile = new SALOMEDS_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); theObjectID = anObjectID; SALOMEDS::lock(); @@ -183,18 +183,18 @@ Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSIm return aTMPFile; } -bool SALOMEDS_Driver_i::CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID) +bool SALOMEDS_Driver_i::CanPaste(const string& theComponentName, int theObjectID) { SALOMEDS::unlock(); - bool canPaste = _driver->CanPaste(theComponentName.ToCString(), theObjectID); + bool canPaste = _driver->CanPaste(theComponentName.c_str(), theObjectID); SALOMEDS::lock(); return canPaste; } -TCollection_AsciiString SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream, - const long theStreamLength, - int theObjectID, - const Handle(SALOMEDSImpl_SObject)& theObject) +string SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream, + const long theStreamLength, + int theObjectID, + const SALOMEDSImpl_SObject& theObject) { SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb); CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; @@ -209,13 +209,13 @@ TCollection_AsciiString SALOMEDS_Driver_i::PasteInto(const unsigned char* theStr SALOMEDS::SObject_var ret_so = _driver->PasteInto(aStream.in(), theObjectID, so.in()); SALOMEDS::lock(); - return TCollection_AsciiString((char*)ret_so->GetID()); + return string(ret_so->GetID()); } -Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, - bool isPublished, - bool& isValidScript, - long& theStreamLength) +SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(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()); @@ -224,7 +224,7 @@ Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDS SALOMEDS::unlock(); CORBA::Boolean aValidScript, aPublished = isPublished; Engines::TMPFile_var aStream = aComponent->DumpPython(st.in(), aPublished, aValidScript); - Handle(SALOMEDSImpl_TMPFile) aTMPFile(new Engines_TMPFile_i(aStream._retn())); + SALOMEDSImpl_TMPFile* aTMPFile = new Engines_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); isValidScript = aValidScript; SALOMEDS::lock(); @@ -236,23 +236,20 @@ Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDS // SALOMEDS_DriverFactory //############################################################################################################### -SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType - (const TCollection_AsciiString& theComponentType) +SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType(const string& theComponentType) { CORBA::Object_var obj; - TCollection_AsciiString aFactoryType; + string aFactoryType; if (theComponentType == "SUPERV") aFactoryType = "SuperVisionContainer"; else aFactoryType = "FactoryServer"; SALOMEDS::unlock(); - obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component - (aFactoryType.ToCString(), theComponentType.ToCString()); + obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component(aFactoryType.c_str(), theComponentType.c_str()); SALOMEDS::lock(); if (CORBA::is_nil(obj)) { - obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component - ("FactoryServerPy", theComponentType.ToCString()); + obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServerPy", theComponentType.c_str()); } if (!CORBA::is_nil(obj)) { @@ -263,10 +260,10 @@ SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType return NULL; } -SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByIOR(const TCollection_AsciiString& theIOR) +SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByIOR(const string& theIOR) { CORBA::Object_var obj; - obj = _orb->string_to_object(theIOR.ToCString()); + obj = _orb->string_to_object(theIOR.c_str()); if (!CORBA::is_nil(obj)) { SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj); diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.hxx b/src/SALOMEDS/SALOMEDS_Driver_i.hxx index 308206323..321b188cf 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.hxx @@ -21,7 +21,6 @@ #define __SALOMEDS_DRIVER_I_H__ #include -#include #include "SALOMEDSImpl_Driver.hxx" #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_SObject.hxx" @@ -46,70 +45,70 @@ public: ~SALOMEDS_Driver_i(); - virtual TCollection_AsciiString GetIOR() + virtual std::string GetIOR() { CORBA::String_var ior = _orb->object_to_string(_driver); - return TCollection_AsciiString(ior); + return std::string(ior); } - virtual Handle(SALOMEDSImpl_TMPFile) Save(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile); + virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent, + const std::string& theURL, + long& theStreamLength, + bool isMultiFile); - virtual Handle(SALOMEDSImpl_TMPFile) SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile); + virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent, + const std::string& theURL, + long& theStreamLength, + bool isMultiFile); - virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent, + virtual bool Load(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const std::string& theURL, bool isMultiFile); - virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, + virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const std::string& theURL, bool isMultiFile); - virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent); + virtual void Close(const SALOMEDSImpl_SComponent& theComponent); - virtual TCollection_AsciiString ComponentDataType() + virtual std::string ComponentDataType() { CORBA::String_var ior = _driver->ComponentDataType(); - return TCollection_AsciiString(ior); + return std::string(ior); } - virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject, - const TCollection_AsciiString& IORString, - bool isMultiFile, - bool isASCII); + virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject, + const std::string& IORString, + bool isMultiFile, + bool isASCII); - virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject, - const TCollection_AsciiString& aLocalPersistentID, - bool isMultiFile, - bool isASCII); + virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject, + const std::string& aLocalPersistentID, + bool isMultiFile, + bool isASCII); - virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject); + virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject); - virtual Handle(SALOMEDSImpl_TMPFile) CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, - int& theObjectID, - long& theStreamLength); + virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject, + int& theObjectID, + long& theStreamLength); - virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID); + virtual bool CanPaste(const std::string& theComponentName, int theObjectID); - virtual TCollection_AsciiString PasteInto(const unsigned char* theStream, - const long theStreamLength, - int theObjectID, - const Handle(SALOMEDSImpl_SObject)& theObject); + virtual std::string PasteInto(const unsigned char* theStream, + const long theStreamLength, + int theObjectID, + const SALOMEDSImpl_SObject& theObject); - virtual Handle(SALOMEDSImpl_TMPFile) DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, - bool isPublished, - bool& isValidScript, - long& theStreamLength); + virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy, + bool isPublished, + bool& isValidScript, + long& theStreamLength); }; #include "SALOME_NamingService.hxx" @@ -135,9 +134,9 @@ public: delete _name_service; } - virtual SALOMEDSImpl_Driver* GetDriverByType(const TCollection_AsciiString& theComponentType); + virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType); - virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR); + virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl deleted file mode 100644 index 42f14a496..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx deleted file mode 100644 index bac353f3e..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_ExpandableAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_ExpandableAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExpandableAttribute::GetID () -{ - static Standard_GUID SALOMEDS_ExpandableAttributeID ("12837185-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_ExpandableAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_ExpandableAttribute) SALOMEDS_ExpandableAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_ExpandableAttribute) A; - if (!L.FindAttribute(SALOMEDS_ExpandableAttribute::GetID(),A)) { - A = new SALOMEDS_ExpandableAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_ExpandableAttribute::SALOMEDS_ExpandableAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExpandableAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_ExpandableAttribute::NewEmpty () const -{ - return new SALOMEDS_ExpandableAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_ExpandableAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_ExpandableAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx deleted file mode 100644 index 182920994..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_ExpandableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_ExpandableAttribute_HeaderFile -#define _SALOMEDS_ExpandableAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_ExpandableAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_ExpandableAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_ExpandableAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_ExpandableAttribute(); -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 ~SALOMEDS_ExpandableAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_ExpandableAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx deleted file mode 100644 index 75767cdd1..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_ExpandableAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_ExpandableAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_ExpandableAttribute::~SALOMEDS_ExpandableAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_ExpandableAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_ExpandableAttribute", - sizeof(SALOMEDS_ExpandableAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_ExpandableAttribute) Handle(SALOMEDS_ExpandableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_ExpandableAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_ExpandableAttribute))) { - _anOtherObject = Handle(SALOMEDS_ExpandableAttribute)((Handle(SALOMEDS_ExpandableAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_ExpandableAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_ExpandableAttribute) ; -} -Standard_Boolean SALOMEDS_ExpandableAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_ExpandableAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_ExpandableAttribute::~Handle_SALOMEDS_ExpandableAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx b/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx deleted file mode 100644 index ea8080e89..000000000 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_ExpandableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_ExpandableAttribute_HeaderFile -#include "SALOMEDS_ExpandableAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl b/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl deleted file mode 100644 index 5fc59615a..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx deleted file mode 100644 index d3b949319..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_ExternalFileDef.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_ExternalFileDef.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExternalFileDef::GetID () -{ - static Standard_GUID SALOMEDS_ExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE"); - return SALOMEDS_ExternalFileDefID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_ExternalFileDef) SALOMEDS_ExternalFileDef::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - - Handle(SALOMEDS_ExternalFileDef) A; - if (!L.FindAttribute(SALOMEDS_ExternalFileDef::GetID(),A)) { - A = new SALOMEDS_ExternalFileDef(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_ExternalFileDef::SALOMEDS_ExternalFileDef() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_ExternalFileDef::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_ExternalFileDef::NewEmpty () const -{ - return new SALOMEDS_ExternalFileDef(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_ExternalFileDef::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_ExternalFileDef::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx deleted file mode 100644 index 4dd12b5ca..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx +++ /dev/null @@ -1,110 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef _SALOMEDS_ExternalFileDef_HeaderFile -#define _SALOMEDS_ExternalFileDef_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_ExternalFileDef_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_ExternalFileDef : public TDataStd_Comment { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_ExternalFileDef Set(const TDF_Label& label,const TCollection_ExtendedString& Name) ; -Standard_EXPORT SALOMEDS_ExternalFileDef(); -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 ~SALOMEDS_ExternalFileDef(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_ExternalFileDef_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx deleted file mode 100644 index fbaa64cf9..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx +++ /dev/null @@ -1,75 +0,0 @@ -// File generated by CPPExt (Transient) -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_ExternalFileDef::~SALOMEDS_ExternalFileDef() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_ExternalFileDef_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_ExternalFileDef", - sizeof(SALOMEDS_ExternalFileDef), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_ExternalFileDef) Handle(SALOMEDS_ExternalFileDef)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_ExternalFileDef) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_ExternalFileDef))) { - _anOtherObject = Handle(SALOMEDS_ExternalFileDef)((Handle(SALOMEDS_ExternalFileDef)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_ExternalFileDef::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_ExternalFileDef) ; -} -Standard_Boolean SALOMEDS_ExternalFileDef::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_ExternalFileDef) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_ExternalFileDef::~Handle_SALOMEDS_ExternalFileDef() {} - diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx deleted file mode 100644 index 7a0cd5471..000000000 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_ExternalFileDef_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_FileType.cdl b/src/SALOMEDS/SALOMEDS_FileType.cdl deleted file mode 100644 index b539acd5a..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_FileType.cxx b/src/SALOMEDS/SALOMEDS_FileType.cxx deleted file mode 100644 index ef714eb16..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_FileType.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_FileType.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_FileType::GetID () -{ - static Standard_GUID SALOMEDS_FileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340"); - return SALOMEDS_FileTypeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_FileType) SALOMEDS_FileType::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - - Handle(SALOMEDS_FileType) A; - if (!L.FindAttribute(SALOMEDS_FileType::GetID(),A)) { - A = new SALOMEDS_FileType(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_FileType::SALOMEDS_FileType() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_FileType::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_FileType::NewEmpty () const -{ - return new SALOMEDS_FileType(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_FileType::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_FileType::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_FileType.hxx b/src/SALOMEDS/SALOMEDS_FileType.hxx deleted file mode 100644 index 476e04ace..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.hxx +++ /dev/null @@ -1,110 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef _SALOMEDS_FileType_HeaderFile -#define _SALOMEDS_FileType_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_FileType_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_FileType : public TDataStd_Comment { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_FileType Set(const TDF_Label& label,const TCollection_ExtendedString& Name) ; -Standard_EXPORT SALOMEDS_FileType(); -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 ~SALOMEDS_FileType(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_FileType_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_FileType.ixx b/src/SALOMEDS/SALOMEDS_FileType.ixx deleted file mode 100644 index 49acdb530..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.ixx +++ /dev/null @@ -1,74 +0,0 @@ -// File generated by CPPExt (Transient) -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_FileType::~SALOMEDS_FileType() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_FileType_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_FileType", - sizeof(SALOMEDS_FileType), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_FileType) Handle(SALOMEDS_FileType)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_FileType) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_FileType))) { - _anOtherObject = Handle(SALOMEDS_FileType)((Handle(SALOMEDS_FileType)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_FileType::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_FileType) ; -} -Standard_Boolean SALOMEDS_FileType::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_FileType) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_FileType::~Handle_SALOMEDS_FileType() {} - diff --git a/src/SALOMEDS/SALOMEDS_FileType.jxx b/src/SALOMEDS/SALOMEDS_FileType.jxx deleted file mode 100644 index 81932deae..000000000 --- a/src/SALOMEDS/SALOMEDS_FileType.jxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_FileType_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx b/src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx deleted file mode 100644 index 15fcb951b..000000000 --- a/src/SALOMEDS/SALOMEDS_FlagsAttribute.cxx +++ /dev/null @@ -1,162 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_FlagsAttribute.cxx -// Author : Sergey LITONIN -// Module : SALOME - -#include "SALOMEDS_FlagsAttribute.hxx" -#include -#include -#include - -using namespace std; - - -/* - Class : SALOMEDS_FlagsAttribute - Description : This class is intended for storing different object attributes that - have only two states (0 and 1). -*/ - -IMPLEMENT_STANDARD_HANDLE( SALOMEDS_FlagsAttribute, TDataStd_Integer ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_FlagsAttribute, TDataStd_Integer ) - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::GetID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_FlagsAttribute::GetID () -{ - static Standard_GUID SALOMEDS_FlagsAttributeID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" ); - return SALOMEDS_FlagsAttributeID; -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Set -//purpose : Set value of the attribute -//======================================================================= -Handle(SALOMEDS_FlagsAttribute) SALOMEDS_FlagsAttribute::Set( const TDF_Label& L, - const Standard_Integer value ) -{ - Handle(SALOMEDS_FlagsAttribute) A; - if ( !L.FindAttribute(SALOMEDS_FlagsAttribute::GetID(),A ) ) - { - A = new SALOMEDS_FlagsAttribute(); - L.AddAttribute( A ); - } - - ( Handle(TDataStd_Integer)::DownCast( A ) )->Set( value ); - return A; -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::SALOMEDS_FlagsAttribute -//purpose : Constructor -//======================================================================= -SALOMEDS_FlagsAttribute::SALOMEDS_FlagsAttribute() -{ - TDataStd_Integer::Set( 0 ); -} - -SALOMEDS_FlagsAttribute::~SALOMEDS_FlagsAttribute() -{ -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::ID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_FlagsAttribute::ID () const -{ - return GetID(); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::NewEmpty -//purpose : Create new empty attribute -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_FlagsAttribute::NewEmpty () const -{ - return new SALOMEDS_FlagsAttribute(); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Restore -//purpose : Assign given value to the attribute -//======================================================================= -void SALOMEDS_FlagsAttribute::Restore( const Handle(TDF_Attribute)& with ) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast( with )->Get(); - TDataStd_Integer::Set( s ); - return; -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Paste -//purpose : Assign internal value to the given attribute -//======================================================================= -void SALOMEDS_FlagsAttribute::Paste( const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT ) const -{ - Handle(TDataStd_Integer)::DownCast( into )->Set( Get() ); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Set -//purpose : Set value -//======================================================================= -void SALOMEDS_FlagsAttribute::Set( const Standard_Integer v ) -{ - TDataStd_Integer::Set( v ); -} - -//======================================================================= -//function : SALOMEDS_FlagsAttribute::Get -//purpose : GetValue -//======================================================================= -Standard_Integer SALOMEDS_FlagsAttribute::Get() const -{ - return TDataStd_Integer::Get(); -} - - - - - - - - - - - - - - - - - - - - diff --git a/src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx b/src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx deleted file mode 100644 index ed69b5ff1..000000000 --- a/src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx +++ /dev/null @@ -1,72 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_FlagsAttribute.hxx -// Author : Sergey LITONIN -// Module : SALOME - -#ifndef SALOMEDS_FlagsAttribute_HeaderFile -#define SALOMEDS_FlagsAttribute_HeaderFile - -#include -#include -#include - -class Standard_GUID; -class TDF_Label; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -/* - Class : SALOMEDS_FlagsAttribute - Description : This class is intended for storing different object attributes that - have only two states (0 and 1). -*/ - -DEFINE_STANDARD_HANDLE( SALOMEDS_FlagsAttribute, TDataStd_Integer ) - -class Standard_EXPORT SALOMEDS_FlagsAttribute : public TDataStd_Integer -{ -public: - -static const Standard_GUID& GetID() ; -static Handle(SALOMEDS_FlagsAttribute) Set( const TDF_Label&, - const Standard_Integer ); - - SALOMEDS_FlagsAttribute(); -virtual ~SALOMEDS_FlagsAttribute(); - -const Standard_GUID& ID() const; -void Restore( const Handle(TDF_Attribute)& with ); -Handle_TDF_Attribute NewEmpty() const; -void Paste( const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT ) const; -void Set( const Standard_Integer ); -Standard_Integer Get() const; - -public: - DEFINE_STANDARD_RTTI( SALOMEDS_FlagsAttribute ) -}; - -#endif diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx index dbbe153e0..b0666a4d2 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx @@ -24,7 +24,6 @@ #include -#include #include "SALOMEDS_GenericAttribute.hxx" #include "SALOMEDSImpl_SObject.hxx" @@ -43,7 +42,7 @@ using namespace std; -SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA) +SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDSImpl_GenericAttribute* theGA) { _isLocal = true; _local_impl = theGA; @@ -97,7 +96,7 @@ std::string SALOMEDS_GenericAttribute::Type() std::string aType; if (_isLocal) { SALOMEDS::Locker lock; - aType = _local_impl->Type().ToCString(); + aType = _local_impl->Type(); } else { aType = _corba_impl->Type(); @@ -110,7 +109,7 @@ std::string SALOMEDS_GenericAttribute::GetClassType() std::string aType; if (_isLocal) { SALOMEDS::Locker lock; - aType = _local_impl->GetClassType().ToCString(); + aType = _local_impl->GetClassType(); } else { aType = _corba_impl->GetClassType(); @@ -133,21 +132,24 @@ _PTR(SObject) SALOMEDS_GenericAttribute::GetSObject() } -SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute - (const Handle(SALOMEDSImpl_GenericAttribute)& theGA) +SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDSImpl_GenericAttribute* theGA) { SALOMEDS::Locker lock; SALOMEDS_GenericAttribute* aGA = NULL; - std::string aTypeOfAttribute = theGA->GetClassType().ToCString(); - __CreateGenericClientAttributeLocal + if(theGA) { + std::string aTypeOfAttribute = theGA->GetClassType(); + __CreateGenericClientAttributeLocal + } return aGA; } SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA) { SALOMEDS_GenericAttribute* aGA = NULL; - std::string aTypeOfAttribute = theGA->GetClassType(); - __CreateGenericClientAttributeCORBA + if(!CORBA::is_nil(theGA)) { + std::string aTypeOfAttribute = theGA->GetClassType(); + __CreateGenericClientAttributeCORBA + } return aGA; } diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx index df3f27392..102304918 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.hxx @@ -37,11 +37,11 @@ class Standard_EXPORT SALOMEDS_GenericAttribute: public virtual SALOMEDSClient_G { protected: bool _isLocal; - Handle(SALOMEDSImpl_GenericAttribute) _local_impl; + SALOMEDSImpl_GenericAttribute* _local_impl; SALOMEDS::GenericAttribute_var _corba_impl; public: - SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA); + SALOMEDS_GenericAttribute(SALOMEDSImpl_GenericAttribute* theGA); SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ptr theGA); virtual ~SALOMEDS_GenericAttribute(); @@ -50,7 +50,7 @@ public: std::string GetClassType(); _PTR(SObject) GetSObject(); - static SALOMEDS_GenericAttribute* CreateAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA); + static SALOMEDS_GenericAttribute* CreateAttribute(SALOMEDSImpl_GenericAttribute* theGA); static SALOMEDS_GenericAttribute* CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA); }; diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx index d5ce15664..6c25a767a 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx @@ -29,7 +29,6 @@ #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_Study.hxx" #include "Utils_ExceptHandlers.hxx" -#include #include #ifdef WIN32 @@ -45,7 +44,7 @@ using namespace std; UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection); -SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb) +SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb) { _orb = CORBA::ORB::_duplicate(theOrb); _impl = theImpl; @@ -56,7 +55,7 @@ void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribut SALOMEDS::Locker lock; Unexpect aCatch(GALockProtection); - if (!_impl.IsNull() && _impl->IsValid() && !CORBA::is_nil(_orb)) { + if (_impl && !CORBA::is_nil(_orb)) { try { SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(_impl); } @@ -69,8 +68,8 @@ void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribut 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()); + if (!_impl || _impl->Label().IsNull()) return SALOMEDS::SObject::_nil(); + SALOMEDSImpl_SObject so_impl = SALOMEDSImpl_Study::SObject(_impl->Label()); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (so_impl, _orb); return so._retn(); } @@ -79,7 +78,7 @@ SALOMEDS::SObject_ptr SALOMEDS_GenericAttribute_i::GetSObject() char* SALOMEDS_GenericAttribute_i::Type() { SALOMEDS::Locker lock; - if (!_impl.IsNull()) { + if (_impl) { return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetType(_impl)); } @@ -89,7 +88,7 @@ char* SALOMEDS_GenericAttribute_i::Type() char* SALOMEDS_GenericAttribute_i::GetClassType() { SALOMEDS::Locker lock; - if (!_impl.IsNull()) { + if (_impl) { return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetClassType(_impl)); } @@ -98,30 +97,13 @@ char* SALOMEDS_GenericAttribute_i::GetClassType() SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute - (const Handle(TDF_Attribute)& theAttr, - CORBA::ORB_ptr theOrb) + (DF_Attribute* theAttr, + CORBA::ORB_ptr theOrb) { SALOMEDS::Locker lock; -/* - static std::map _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 - TCollection_AsciiString aClassType = Handle(SALOMEDSImpl_GenericAttribute):: - DownCast(theAttr)->GetClassType(); - char* aTypeOfAttribute = aClassType.ToCString(); + string aClassType = dynamic_cast(theAttr)->GetClassType(); + char* aTypeOfAttribute = (char*)aClassType.c_str(); SALOMEDS::GenericAttribute_var anAttribute; SALOMEDS_GenericAttribute_i* attr_servant = NULL; __CreateGenericCORBAAttribute @@ -140,6 +122,5 @@ CORBA::LongLong SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostnam long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - TDF_Attribute* local_impl = _impl.operator->(); - return ((CORBA::LongLong)local_impl); + return ((CORBA::LongLong)_impl); } diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx index 093ed285a..08252579d 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx @@ -28,7 +28,7 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) #include -#include +#include "DF_Attribute.hxx" #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" @@ -38,11 +38,11 @@ class Standard_EXPORT SALOMEDS_GenericAttribute_i: public virtual POA_SALOMEDS:: { protected: - Handle(TDF_Attribute) _impl; - CORBA::ORB_ptr _orb; + DF_Attribute* _impl; + CORBA::ORB_ptr _orb; public: - SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb); + SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb); virtual ~SALOMEDS_GenericAttribute_i() {}; void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection); @@ -53,9 +53,9 @@ public: SALOMEDS::SObject_ptr GetSObject(); - virtual Handle(TDF_Attribute) GetImpl() { return _impl; } + virtual DF_Attribute* GetImpl() { return _impl; } - static SALOMEDS::GenericAttribute_ptr CreateAttribute(const Handle(TDF_Attribute)& theAttr, CORBA::ORB_ptr theOrb); + static SALOMEDS::GenericAttribute_ptr CreateAttribute(DF_Attribute* theAttr, CORBA::ORB_ptr theOrb); virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; diff --git a/src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx b/src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx deleted file mode 100644 index ba9bd493c..000000000 --- a/src/SALOMEDS/SALOMEDS_GraphicAttribute.cxx +++ /dev/null @@ -1,185 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_GraphicAttribute.cxx -// Author : Sergey LITONIN -// Module : SALOME - -#include "SALOMEDS_GraphicAttribute.hxx" -#include -#include -#include -#include - -/* - Class : SALOMEDS_GraphicAttribute - Description : This class is intended for storing information about - graphic representation of objects in dirrent views -*/ - -IMPLEMENT_STANDARD_HANDLE( SALOMEDS_GraphicAttribute, TDF_Attribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_GraphicAttribute, TDF_Attribute ) - -//======================================================================= -//function : GetID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_GraphicAttribute::GetID() -{ - static Standard_GUID SALOMEDS_GraphicAttributeID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" ); - return SALOMEDS_GraphicAttributeID; -} - -//======================================================================= -//function : SALOMEDS_GraphicAttribute -//purpose : Empty Constructor -//======================================================================= -SALOMEDS_GraphicAttribute::SALOMEDS_GraphicAttribute() -{ -} - -//======================================================================= -//function : ~SALOMEDS_GraphicAttribute -//purpose : Destructor -//======================================================================= -SALOMEDS_GraphicAttribute::~SALOMEDS_GraphicAttribute() -{ -} - -//======================================================================= -//function : SetVisibility -//purpose : Set visibility of object in given view -//======================================================================= -void SALOMEDS_GraphicAttribute::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 SALOMEDS_GraphicAttribute::GetVisibility( - const Standard_Integer theViewId ) const -{ - return myVisibility.IsBound( theViewId ) ? myVisibility( theViewId ) : false; -} - - -//======================================================================= -//function : ID -//purpose : Get GUID of this attribute -//======================================================================= -const Standard_GUID& SALOMEDS_GraphicAttribute::ID () const -{ - return GetID(); -} - - -//======================================================================= -//function : NewEmpty -//purpose : Create new empty attribute -//======================================================================= -Handle(TDF_Attribute) SALOMEDS_GraphicAttribute::NewEmpty () const -{ - return new SALOMEDS_GraphicAttribute (); -} - -//======================================================================= -//function : SetVisibility -//purpose : Set visibility of object in all views -//======================================================================= -void SALOMEDS_GraphicAttribute::SetVisibility( const TColStd_DataMapOfIntegerInteger& theMap ) -{ - myVisibility = theMap; -} - -//======================================================================= -//function : SetVisibility -//purpose : Get visibility of object in all views -//======================================================================= -const TColStd_DataMapOfIntegerInteger& SALOMEDS_GraphicAttribute::GetVisibility() -{ - return myVisibility; -} - -//======================================================================= -//function : Restore -//purpose : Restore value of attribute with value of theWith one -//======================================================================= -void SALOMEDS_GraphicAttribute::Restore( const Handle(TDF_Attribute)& theWith ) -{ - Handle(SALOMEDS_GraphicAttribute) anAttr = - Handle(SALOMEDS_GraphicAttribute)::DownCast( theWith ); - - if ( !anAttr.IsNull() ) - SetVisibility( anAttr->GetVisibility() ); -} - -//======================================================================= -//function : Paste -//purpose : Paste value of current attribute to the value of entry one -//======================================================================= -void SALOMEDS_GraphicAttribute::Paste( const Handle(TDF_Attribute)& theInto, - const Handle(TDF_RelocationTable)& ) const -{ - Handle(SALOMEDS_GraphicAttribute) anAttr = - Handle(SALOMEDS_GraphicAttribute)::DownCast( theInto ); - - if ( !anAttr.IsNull() ) - anAttr->SetVisibility( myVisibility ); -} - -//======================================================================= -//function : Dump -//purpose : Dump -//======================================================================= -Standard_OStream& SALOMEDS_GraphicAttribute::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; -} - diff --git a/src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx b/src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx deleted file mode 100644 index 554d10c4d..000000000 --- a/src/SALOMEDS/SALOMEDS_GraphicAttribute.hxx +++ /dev/null @@ -1,80 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_GraphicAttribute.hxx -// Author : Sergey LITONIN -// Module : SALOME - -#ifndef SALOMEDS_GraphicAttribute_HeaderFile -#define SALOMEDS_GraphicAttribute_HeaderFile - -#include -#include -#include -#include - -class Standard_GUID; -class TDF_Label; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -/* - Class : SALOMEDS_GraphicAttribute - Description : This class is intended for storing information about - graphic representation of objects in dirrent views -*/ - -DEFINE_STANDARD_HANDLE( SALOMEDS_GraphicAttribute, TDF_Attribute ) - -class Standard_EXPORT SALOMEDS_GraphicAttribute : public TDF_Attribute -{ - -public: - SALOMEDS_GraphicAttribute(); - ~SALOMEDS_GraphicAttribute(); - - static const Standard_GUID& GetID() ; - - void SetVisibility( const Standard_Integer, - const Standard_Boolean ); - Standard_Boolean GetVisibility( const Standard_Integer ) const; - const Standard_GUID& ID() const; - void Restore( const Handle(TDF_Attribute)& theWith ); - Handle(TDF_Attribute) NewEmpty() const; - void Paste( const Handle(TDF_Attribute)& theInto, - const Handle(TDF_RelocationTable)& ) const; - virtual Standard_OStream& Dump( Standard_OStream& anOS ) const; - - void SetVisibility( const TColStd_DataMapOfIntegerInteger& ); - - const TColStd_DataMapOfIntegerInteger& GetVisibility(); - -private: - TColStd_DataMapOfIntegerInteger myVisibility; - -public: - DEFINE_STANDARD_RTTI( SALOMEDS_GraphicAttribute ) -}; - -#endif diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.cdl b/src/SALOMEDS/SALOMEDS_IORAttribute.cdl deleted file mode 100644 index d1f63c83e..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.cxx b/src/SALOMEDS/SALOMEDS_IORAttribute.cxx deleted file mode 100644 index 04dd74d25..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_IORAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include -#include - -#include "SALOMEDS_IORAttribute.ixx" -#include "SALOMEDS_Study_i.hxx" - -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_IORAttribute::GetID () -{ - static Standard_GUID SALOMEDS_IORAttributeID ("92888E01-7074-11d5-A690-0800369C8A03"); - return SALOMEDS_IORAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_IORAttribute) SALOMEDS_IORAttribute::Set (const TDF_Label& L, - const TCollection_ExtendedString& S, - SALOMEDS_Study_i* theStudy) -{ - Handle(SALOMEDS_IORAttribute) A; - if (!L.FindAttribute(SALOMEDS_IORAttribute::GetID(),A)) { - A = new SALOMEDS_IORAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - theStudy->IORUpdated(A); - return A; -} - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_IORAttribute::SALOMEDS_IORAttribute() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_IORAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_IORAttribute::NewEmpty () const -{ - return new SALOMEDS_IORAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_IORAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_IORAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.hxx b/src/SALOMEDS/SALOMEDS_IORAttribute.hxx deleted file mode 100644 index 0979aee7b..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.hxx +++ /dev/null @@ -1,131 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_IORAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_IORAttribute_HeaderFile -#define _SALOMEDS_IORAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_IORAttribute_HeaderFile -#include "Handle_SALOMEDS_IORAttribute.hxx" -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif - -#include -#include CORBA_SERVER_HEADER(SALOMEDS) - -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; -class SALOMEDS_Study_i; - -class SALOMEDS_IORAttribute : public TDataStd_Comment { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_IORAttribute Set(const TDF_Label& label, - const TCollection_ExtendedString& string, - SALOMEDS_Study_i* theStudy) ; -Standard_EXPORT SALOMEDS_IORAttribute(); -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 ~SALOMEDS_IORAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_IORAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.ixx b/src/SALOMEDS/SALOMEDS_IORAttribute.ixx deleted file mode 100644 index 59ef72dfb..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_IORAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_IORAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_IORAttribute::~SALOMEDS_IORAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_IORAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_IORAttribute", - sizeof(SALOMEDS_IORAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_IORAttribute) Handle(SALOMEDS_IORAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_IORAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_IORAttribute))) { - _anOtherObject = Handle(SALOMEDS_IORAttribute)((Handle(SALOMEDS_IORAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_IORAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_IORAttribute) ; -} -Standard_Boolean SALOMEDS_IORAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_IORAttribute) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_IORAttribute::~Handle_SALOMEDS_IORAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.jxx b/src/SALOMEDS/SALOMEDS_IORAttribute.jxx deleted file mode 100644 index 415f1006f..000000000 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.jxx +++ /dev/null @@ -1,44 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_IORAttribute.jxx -// Module : SALOME - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_IORAttribute_HeaderFile -#include "SALOMEDS_IORAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_IParameters.cxx b/src/SALOMEDS/SALOMEDS_IParameters.cxx index 78d4ff8a1..93466d8fb 100644 --- a/src/SALOMEDS/SALOMEDS_IParameters.cxx +++ b/src/SALOMEDS/SALOMEDS_IParameters.cxx @@ -19,8 +19,6 @@ #include "SALOMEDS_IParameters.hxx" #include -#include - using namespace std; #define PT_INTEGER 0 @@ -199,22 +197,22 @@ vector SALOMEDS_IParameters::getProperties() vector SALOMEDS_IParameters::parseValue(const string& value, const char separator, bool fromEnd) { - TCollection_AsciiString val((char*)value.c_str()); + string val(value); vector v; int pos; - if(fromEnd) pos = val.SearchFromEnd(separator); - else pos = val.Search(separator); + if(fromEnd) pos = val.rfind(separator); + else pos = val.find(separator); if(pos < 0) { v.push_back(value); return v; } - TCollection_AsciiString part1, part2; - part1 = val.SubString(1, pos-1); - part2 = val.SubString(pos+1, val.Length()); - v.push_back(part1.ToCString()); - v.push_back(part2.ToCString()); + string part1, part2; + part1 = val.substr(0, pos); + part2 = val.substr(pos+1, val.size()); + v.push_back(part1); + v.push_back(part2); return v; } diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl deleted file mode 100644 index ba3615d2e..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cdl +++ /dev/null @@ -1,72 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx deleted file mode 100644 index c6d705bc7..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_LocalIDAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_LocalIDAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_LocalIDAttribute::GetID () -{ - static Standard_GUID SALOMEDS_OpenedAttributeID ("12837196-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_OpenedAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_LocalIDAttribute) SALOMEDS_LocalIDAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_LocalIDAttribute) A; - if (!L.FindAttribute(SALOMEDS_LocalIDAttribute::GetID(),A)) { - A = new SALOMEDS_LocalIDAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_LocalIDAttribute::SALOMEDS_LocalIDAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_LocalIDAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_LocalIDAttribute::NewEmpty () const -{ - return new SALOMEDS_LocalIDAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_LocalIDAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_LocalIDAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx deleted file mode 100644 index 6eb8e580f..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_LocalIDAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_LocalIDAttribute_HeaderFile -#define _SALOMEDS_LocalIDAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_LocalIDAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_LocalIDAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_LocalIDAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_LocalIDAttribute(); -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 ~SALOMEDS_LocalIDAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_LocalIDAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx deleted file mode 100644 index c0d1166bc..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_LocalIDAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_LocalIDAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_LocalIDAttribute::~SALOMEDS_LocalIDAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_LocalIDAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_LocalIDAttribute", - sizeof(SALOMEDS_LocalIDAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_LocalIDAttribute) Handle(SALOMEDS_LocalIDAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_LocalIDAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_LocalIDAttribute))) { - _anOtherObject = Handle(SALOMEDS_LocalIDAttribute)((Handle(SALOMEDS_LocalIDAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_LocalIDAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_LocalIDAttribute) ; -} -Standard_Boolean SALOMEDS_LocalIDAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_LocalIDAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_LocalIDAttribute::~Handle_SALOMEDS_LocalIDAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx b/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx deleted file mode 100644 index 91665a49e..000000000 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_LocalIDAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_LocalIDAttribute_HeaderFile -#include "SALOMEDS_LocalIDAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.cdl b/src/SALOMEDS/SALOMEDS_OCAFApplication.cdl deleted file mode 100644 index 6e771b87f..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.cdl +++ /dev/null @@ -1,45 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.cxx b/src/SALOMEDS/SALOMEDS_OCAFApplication.cxx deleted file mode 100644 index 2cef1f64b..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OCAFApplication.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OCAFApplication.ixx" -using namespace std; - -//======================================================================= -//function : SALOMEDS_OCAFApplication -//purpose : -//======================================================================= - -SALOMEDS_OCAFApplication::SALOMEDS_OCAFApplication() -{ -} - - -//======================================================================= -//function : Formats -//purpose : -//======================================================================= - -void SALOMEDS_OCAFApplication::Formats(TColStd_SequenceOfExtendedString& Formats) -{ - Formats.Append(TCollection_ExtendedString ("SALOME_STUDY")); -} - - -//======================================================================= -//function : ResourcesName -//purpose : -//======================================================================= - -Standard_CString SALOMEDS_OCAFApplication::ResourcesName() -{ - return Standard_CString ("SALOMEDS_Resources"); -} - - - - - diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.hxx b/src/SALOMEDS/SALOMEDS_OCAFApplication.hxx deleted file mode 100644 index 9b871ffa5..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.hxx +++ /dev/null @@ -1,114 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OCAFApplication.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_OCAFApplication_HeaderFile -#define _SALOMEDS_OCAFApplication_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_OCAFApplication_HeaderFile -#include "Handle_SALOMEDS_OCAFApplication.hxx" -#endif - -#ifndef _TDocStd_Application_HeaderFile -#include -#endif -#ifndef _Standard_CString_HeaderFile -#include -#endif -class TColStd_SequenceOfExtendedString; - - -class SALOMEDS_OCAFApplication : public TDocStd_Application { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT SALOMEDS_OCAFApplication(); -Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) ; -Standard_EXPORT Standard_CString ResourcesName() ; -Standard_EXPORT ~SALOMEDS_OCAFApplication(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_OCAFApplication_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.ixx b/src/SALOMEDS/SALOMEDS_OCAFApplication.ixx deleted file mode 100644 index 869b19a32..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OCAFApplication.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OCAFApplication.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_OCAFApplication::~SALOMEDS_OCAFApplication() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_OCAFApplication_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDocStd_Application); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDocStd_Application); - static Handle_Standard_Type aType2 = STANDARD_TYPE(CDF_Application); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(CDF_Application); - static Handle_Standard_Type aType3 = STANDARD_TYPE(CDM_Application); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(CDM_Application); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_OCAFApplication", - sizeof(SALOMEDS_OCAFApplication), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_OCAFApplication) Handle(SALOMEDS_OCAFApplication)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_OCAFApplication) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_OCAFApplication))) { - _anOtherObject = Handle(SALOMEDS_OCAFApplication)((Handle(SALOMEDS_OCAFApplication)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_OCAFApplication::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_OCAFApplication) ; -} -Standard_Boolean SALOMEDS_OCAFApplication::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_OCAFApplication) == AType || TDocStd_Application::IsKind(AType)); -} -Handle_SALOMEDS_OCAFApplication::~Handle_SALOMEDS_OCAFApplication() {} - diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.jxx b/src/SALOMEDS/SALOMEDS_OCAFApplication.jxx deleted file mode 100644 index 3ea3ada01..000000000 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.jxx +++ /dev/null @@ -1,32 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OCAFApplication.jxx -// Module : SALOME - -#ifndef _TColStd_SequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _SALOMEDS_OCAFApplication_HeaderFile -#include "SALOMEDS_OCAFApplication.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl b/src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl deleted file mode 100644 index 1e04ceacf..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cdl +++ /dev/null @@ -1,74 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx deleted file mode 100644 index 11b447e03..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OpenedAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OpenedAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_OpenedAttribute::GetID () -{ - static Standard_GUID SALOMEDS_OpenedAttributeID ("12837186-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_OpenedAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_OpenedAttribute) SALOMEDS_OpenedAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_OpenedAttribute) A; - if (!L.FindAttribute(SALOMEDS_OpenedAttribute::GetID(),A)) { - A = new SALOMEDS_OpenedAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_OpenedAttribute::SALOMEDS_OpenedAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_OpenedAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_OpenedAttribute::NewEmpty () const -{ - return new SALOMEDS_OpenedAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_OpenedAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_OpenedAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx deleted file mode 100644 index 9a66dbd5a..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OpenedAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_OpenedAttribute_HeaderFile -#define _SALOMEDS_OpenedAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_OpenedAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_OpenedAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_OpenedAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_OpenedAttribute(); -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 ~SALOMEDS_OpenedAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_OpenedAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx deleted file mode 100644 index 7f53d48e6..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OpenedAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_OpenedAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_OpenedAttribute::~SALOMEDS_OpenedAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_OpenedAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_OpenedAttribute", - sizeof(SALOMEDS_OpenedAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_OpenedAttribute) Handle(SALOMEDS_OpenedAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_OpenedAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_OpenedAttribute))) { - _anOtherObject = Handle(SALOMEDS_OpenedAttribute)((Handle(SALOMEDS_OpenedAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_OpenedAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_OpenedAttribute) ; -} -Standard_Boolean SALOMEDS_OpenedAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_OpenedAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_OpenedAttribute::~Handle_SALOMEDS_OpenedAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx b/src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx deleted file mode 100644 index 7a429f75b..000000000 --- a/src/SALOMEDS/SALOMEDS_OpenedAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_OpenedAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_OpenedAttribute_HeaderFile -#include "SALOMEDS_OpenedAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl b/src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl deleted file mode 100644 index aba57838e..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx deleted file mode 100644 index 8de157a31..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PersRefAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PersRefAttribute.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PersRefAttribute::GetID () -{ - static Standard_GUID SALOMEDS_PersRefAttributeID ("92888E06-7074-11d5-A690-0800369C8A03"); - return SALOMEDS_PersRefAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_PersRefAttribute) SALOMEDS_PersRefAttribute::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - Handle(SALOMEDS_PersRefAttribute) A; - if (!L.FindAttribute(SALOMEDS_PersRefAttribute::GetID(),A)) { - A = new SALOMEDS_PersRefAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_PersRefAttribute::SALOMEDS_PersRefAttribute() -{} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PersRefAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_PersRefAttribute::NewEmpty () const -{ - return new SALOMEDS_PersRefAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_PersRefAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_PersRefAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx deleted file mode 100644 index 97942b753..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.hxx +++ /dev/null @@ -1,125 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PersRefAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_PersRefAttribute_HeaderFile -#define _SALOMEDS_PersRefAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_PersRefAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_PersRefAttribute : public TDataStd_Comment { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_PersRefAttribute Set(const TDF_Label& label,const TCollection_ExtendedString& string) ; -Standard_EXPORT SALOMEDS_PersRefAttribute(); -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 ~SALOMEDS_PersRefAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PersRefAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx deleted file mode 100644 index 44e9e9338..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PersRefAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PersRefAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_PersRefAttribute::~SALOMEDS_PersRefAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_PersRefAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PersRefAttribute", - sizeof(SALOMEDS_PersRefAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_PersRefAttribute) Handle(SALOMEDS_PersRefAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_PersRefAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PersRefAttribute))) { - _anOtherObject = Handle(SALOMEDS_PersRefAttribute)((Handle(SALOMEDS_PersRefAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_PersRefAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_PersRefAttribute) ; -} -Standard_Boolean SALOMEDS_PersRefAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_PersRefAttribute) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_PersRefAttribute::~Handle_SALOMEDS_PersRefAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx b/src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx deleted file mode 100644 index 13aecf8d1..000000000 --- a/src/SALOMEDS/SALOMEDS_PersRefAttribute.jxx +++ /dev/null @@ -1,44 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PersRefAttribute.jxx -// Module : SALOME - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_PersRefAttribute_HeaderFile -#include "SALOMEDS_PersRefAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl b/src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl deleted file mode 100644 index 7e0b16f1f..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cdl +++ /dev/null @@ -1,73 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx deleted file mode 100644 index 828b5de89..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PixMapAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PixMapAttribute.ixx" -#include -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PixMapAttribute::GetID () -{ - static Standard_GUID SALOMEDS_PixMapAttributeID ("12837187-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_PixMapAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_PixMapAttribute) SALOMEDS_PixMapAttribute::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) -{ - Handle(SALOMEDS_PixMapAttribute) A; - if (!L.FindAttribute(SALOMEDS_PixMapAttribute::GetID(),A)) { - A = new SALOMEDS_PixMapAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Comment)::DownCast(A))->Set (S); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_PixMapAttribute::SALOMEDS_PixMapAttribute() -{TDataStd_Comment::Set("None");} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_PixMapAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_PixMapAttribute::NewEmpty () const -{ - return new SALOMEDS_PixMapAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_PixMapAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); - TDataStd_Comment::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_PixMapAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx deleted file mode 100644 index 1ba561edb..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.hxx +++ /dev/null @@ -1,125 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PixMapAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_PixMapAttribute_HeaderFile -#define _SALOMEDS_PixMapAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_PixMapAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Comment_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_PixMapAttribute : public TDataStd_Comment { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_PixMapAttribute Set(const TDF_Label& label,const TCollection_ExtendedString& string) ; -Standard_EXPORT SALOMEDS_PixMapAttribute(); -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 ~SALOMEDS_PixMapAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PixMapAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx deleted file mode 100644 index c28bd26a8..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PixMapAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PixMapAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_PixMapAttribute::~SALOMEDS_PixMapAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_PixMapAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PixMapAttribute", - sizeof(SALOMEDS_PixMapAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_PixMapAttribute) Handle(SALOMEDS_PixMapAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_PixMapAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PixMapAttribute))) { - _anOtherObject = Handle(SALOMEDS_PixMapAttribute)((Handle(SALOMEDS_PixMapAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_PixMapAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_PixMapAttribute) ; -} -Standard_Boolean SALOMEDS_PixMapAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_PixMapAttribute) == AType || TDataStd_Comment::IsKind(AType)); -} -Handle_SALOMEDS_PixMapAttribute::~Handle_SALOMEDS_PixMapAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx b/src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx deleted file mode 100644 index a087c9366..000000000 --- a/src/SALOMEDS/SALOMEDS_PixMapAttribute.jxx +++ /dev/null @@ -1,46 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_PixMapAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_PixMapAttribute_HeaderFile -#include "SALOMEDS_PixMapAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl deleted file mode 100644 index 83438a2fa..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cdl +++ /dev/null @@ -1,83 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx deleted file mode 100644 index 109cec756..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.cxx +++ /dev/null @@ -1,89 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_PythonObjectAttribute.cxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PythonObjectAttribute.ixx" -#include -using namespace std; - -const Standard_GUID& SALOMEDS_PythonObjectAttribute::GetID() -{ - static Standard_GUID SALOMEDS_PythonObjectAttributeID ("128371A3-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_PythonObjectAttributeID; -} - -Handle(SALOMEDS_PythonObjectAttribute) SALOMEDS_PythonObjectAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_PythonObjectAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_PythonObjectAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_PythonObjectAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_PythonObjectAttribute::SALOMEDS_PythonObjectAttribute() -{ -} - -void SALOMEDS_PythonObjectAttribute::SetObject(const Standard_CString theSequence, - const Standard_Boolean theScript) -{ - Backup(); - if(mySequence != NULL) delete mySequence; - if (theSequence == NULL) { - mySequence = NULL; - } else { - mySequence = new char[strlen(theSequence)+1]; - strcpy(mySequence, theSequence); - } - - myIsScript = theScript; -} - -Standard_CString SALOMEDS_PythonObjectAttribute::GetObject() const -{ - return mySequence; -} - -Standard_Boolean SALOMEDS_PythonObjectAttribute::IsScript() const -{ - return myIsScript; -} - -Standard_Integer SALOMEDS_PythonObjectAttribute::GetLength() const -{ - if (mySequence == NULL) return 0; - return (strlen(mySequence)+1); -} - -const Standard_GUID& SALOMEDS_PythonObjectAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_PythonObjectAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(with); - SetObject(anObj->GetObject(),anObj->IsScript()); -} - -Handle(TDF_Attribute) SALOMEDS_PythonObjectAttribute::NewEmpty() const -{ - return new SALOMEDS_PythonObjectAttribute(); -} - -void SALOMEDS_PythonObjectAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(into); - anObj->SetObject(GetObject(),IsScript()); -} - diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx deleted file mode 100644 index aa872aff8..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.hxx +++ /dev/null @@ -1,126 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_PythonObjectAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_PythonObjectAttribute_HeaderFile -#define _SALOMEDS_PythonObjectAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_PythonObjectAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HArray1OfCharacter_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_CString_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HArray1OfCharacter; -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_PythonObjectAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_PythonObjectAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_PythonObjectAttribute(); -Standard_EXPORT void SetObject(const Standard_CString theSequence,const Standard_Boolean theScript) ; -Standard_EXPORT Standard_CString GetObject() const; -Standard_EXPORT Standard_Boolean IsScript() const; -Standard_EXPORT Standard_Integer 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 ~SALOMEDS_PythonObjectAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PythonObjectAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_CString mySequence; -Standard_Boolean myIsScript; - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx deleted file mode 100644 index cc0894389..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.ixx +++ /dev/null @@ -1,68 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_PythonObjectAttribute.ixx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include "SALOMEDS_PythonObjectAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_PythonObjectAttribute::~SALOMEDS_PythonObjectAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_PythonObjectAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PythonObjectAttribute", - sizeof(SALOMEDS_PythonObjectAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_PythonObjectAttribute) Handle(SALOMEDS_PythonObjectAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_PythonObjectAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PythonObjectAttribute))) { - _anOtherObject = Handle(SALOMEDS_PythonObjectAttribute)((Handle(SALOMEDS_PythonObjectAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_PythonObjectAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_PythonObjectAttribute) ; -} -Standard_Boolean SALOMEDS_PythonObjectAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_PythonObjectAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_PythonObjectAttribute::~Handle_SALOMEDS_PythonObjectAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx b/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx deleted file mode 100644 index d05105e38..000000000 --- a/src/SALOMEDS/SALOMEDS_PythonObjectAttribute.jxx +++ /dev/null @@ -1,29 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_PythonObjectAttribute.jxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HArray1OfCharacter_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_PythonObjectAttribute_HeaderFile -#include "SALOMEDS_PythonObjectAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_SAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_SAttribute_i.hxx deleted file mode 100644 index 0b1106ff0..000000000 --- a/src/SALOMEDS/SALOMEDS_SAttribute_i.hxx +++ /dev/null @@ -1,63 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SAttribute_i.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef __SALOMEDS_SATTRIBUTE_I_H__ -#define __SALOMEDS_SATTRIBUTE_I_H__ - -// std C++ headers -#include - -// IDL headers -#include -#include CORBA_SERVER_HEADER(SALOMEDS) - - - -// Cascade headers -#include -#include - -class SALOMEDS_SAttribute_i: public POA_IStudy::SAttribute, - public PortableServer::ServantBase { -private: - CORBA::ORB_ptr _orb; - char* _Type; - char -public: - - SALOMEDS_SAttribute_i(const Handle(TDocStd_Document), CORBA::ORB_ptr); - - ~SALOMEDS_SAttribute_i(); - - virtual char* GetID() ; - virtual SObject_ptr GetOwner(); - virtual char* GetType(); - virtual char* GetValue(); - -}; -#endif diff --git a/src/SALOMEDS/SALOMEDS_SComponent.cxx b/src/SALOMEDS/SALOMEDS_SComponent.cxx index 65fdc2eaa..07ae3028f 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponent.cxx @@ -29,7 +29,6 @@ #include "SALOMEDS_SComponent_i.hxx" #include -#include using namespace std; @@ -37,7 +36,7 @@ SALOMEDS_SComponent::SALOMEDS_SComponent(SALOMEDS::SComponent_ptr theSComponent) :SALOMEDS_SObject(theSComponent) {} -SALOMEDS_SComponent::SALOMEDS_SComponent(const Handle(SALOMEDSImpl_SComponent)& theSComponent) +SALOMEDS_SComponent::SALOMEDS_SComponent(const SALOMEDSImpl_SComponent& theSComponent) :SALOMEDS_SObject(theSComponent) {} @@ -49,7 +48,7 @@ std::string SALOMEDS_SComponent::ComponentDataType() std::string aType; if (_isLocal) { SALOMEDS::Locker lock; - aType = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentDataType().ToCString(); + aType = (dynamic_cast(GetLocalImpl()))->ComponentDataType(); } else aType = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentDataType(); @@ -61,9 +60,7 @@ bool SALOMEDS_SComponent::ComponentIOR(std::string& theID) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - TCollection_AsciiString anIOR; - ret = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentIOR(anIOR); - theID = anIOR.ToCString(); + ret = (dynamic_cast(GetLocalImpl()))->ComponentIOR(theID); } else { CORBA::String_var anIOR; @@ -78,7 +75,7 @@ SALOMEDS::SComponent_ptr SALOMEDS_SComponent::GetSComponent() { if(_isLocal) { if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl())); - SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()), _orb); + SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(*(dynamic_cast(GetLocalImpl())), _orb); _corba_impl = SALOMEDS::SComponent::_duplicate(aSCO); return aSCO._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_SComponent.hxx b/src/SALOMEDS/SALOMEDS_SComponent.hxx index 56fc38025..129a81d8c 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponent.hxx @@ -36,7 +36,7 @@ class Standard_EXPORT SALOMEDS_SComponent: public SALOMEDS_SObject, public SALOM { public: - SALOMEDS_SComponent(const Handle(SALOMEDSImpl_SComponent)& theSComponent); + SALOMEDS_SComponent(const SALOMEDSImpl_SComponent& theSComponent); SALOMEDS_SComponent(SALOMEDS::SComponent_ptr theSComponent); ~SALOMEDS_SComponent(); diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx index 3736c5e7f..28c1248d6 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx @@ -28,7 +28,7 @@ #include "SALOMEDSImpl_SComponent.hxx" SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator) -:_local_impl(theIterator) +:_local_impl(theIterator.GetPersistentCopy()) { _isLocal = true; _corba_impl = SALOMEDS::SComponentIterator::_nil(); @@ -43,13 +43,14 @@ SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(SALOMEDS::SComponentIte SALOMEDS_SComponentIterator::~SALOMEDS_SComponentIterator() { if(!_isLocal) _corba_impl->Destroy(); + else if(_local_impl) delete _local_impl; } void SALOMEDS_SComponentIterator::Init() { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl.Init(); + _local_impl->Init(); } else _corba_impl->Init(); } @@ -59,7 +60,7 @@ bool SALOMEDS_SComponentIterator::More() bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl.More(); + ret = _local_impl->More(); } else ret = _corba_impl->More(); return ret; @@ -69,7 +70,7 @@ void SALOMEDS_SComponentIterator::Next() { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl.Next(); + _local_impl->Next(); } else _corba_impl->Next(); } @@ -79,7 +80,7 @@ _PTR(SComponent) SALOMEDS_SComponentIterator::Value() SALOMEDSClient_SComponent* aSCO = NULL; if (_isLocal) { SALOMEDS::Locker lock; - aSCO = new SALOMEDS_SComponent(_local_impl.Value()); + aSCO = new SALOMEDS_SComponent(_local_impl->Value()); } else aSCO = new SALOMEDS_SComponent(_corba_impl->Value()); return _PTR(SComponent)(aSCO); diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx b/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx index 3e5419a2e..1dbecadcf 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator.hxx @@ -40,7 +40,7 @@ public: private: bool _isLocal; - SALOMEDSImpl_SComponentIterator _local_impl; + SALOMEDSImpl_SComponentIterator* _local_impl; SALOMEDS::SComponentIterator_var _corba_impl; public: diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx index 197ce8c2b..4f4151c66 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx @@ -36,9 +36,9 @@ using namespace std; SALOMEDS_SComponentIterator_i::SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_SComponentIterator& theImpl, CORBA::ORB_ptr orb) -:_impl(theImpl) { _orb = CORBA::ORB::_duplicate(orb); + _impl = theImpl.GetPersistentCopy(); } //============================================================================ @@ -48,6 +48,7 @@ SALOMEDS_SComponentIterator_i::SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_ //============================================================================ SALOMEDS_SComponentIterator_i::~SALOMEDS_SComponentIterator_i() { + if(_impl) delete _impl; } //============================================================================ @@ -58,7 +59,7 @@ SALOMEDS_SComponentIterator_i::~SALOMEDS_SComponentIterator_i() void SALOMEDS_SComponentIterator_i::Init() { SALOMEDS::Locker lock; - _impl.Init(); + _impl->Init(); } //============================================================================ @@ -69,7 +70,7 @@ void SALOMEDS_SComponentIterator_i::Init() CORBA::Boolean SALOMEDS_SComponentIterator_i::More() { SALOMEDS::Locker lock; - return _impl.More(); + return _impl->More(); } //============================================================================ @@ -79,7 +80,7 @@ CORBA::Boolean SALOMEDS_SComponentIterator_i::More() void SALOMEDS_SComponentIterator_i::Next() { SALOMEDS::Locker lock; - _impl.Next(); + _impl->Next(); } @@ -91,7 +92,7 @@ void SALOMEDS_SComponentIterator_i::Next() SALOMEDS::SComponent_ptr SALOMEDS_SComponentIterator_i::Value() { SALOMEDS::Locker lock; - SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (_impl.Value(), _orb); + SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (_impl->Value(), _orb); return sco._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx index 3335a1a28..0f0759e2b 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx @@ -43,8 +43,8 @@ class SALOMEDS_SComponentIterator_i:public virtual POA_SALOMEDS::SComponentItera private: - CORBA::ORB_ptr _orb; - SALOMEDSImpl_SComponentIterator _impl; + CORBA::ORB_ptr _orb; + SALOMEDSImpl_SComponentIterator* _impl; public: diff --git a/src/SALOMEDS/SALOMEDS_SComponent_i.cxx b/src/SALOMEDS/SALOMEDS_SComponent_i.cxx index e18d9e8c8..8fc689ff7 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponent_i.cxx @@ -29,23 +29,8 @@ using namespace std; -SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr theORB) +SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const SALOMEDSImpl_SComponent& theImpl, CORBA::ORB_ptr theORB) { -/* - static std::map _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()); @@ -57,7 +42,7 @@ SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const Handle(SALOMEDSImpl_SC * Purpose : */ //============================================================================ -SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr orb) +SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(const SALOMEDSImpl_SComponent& theImpl, CORBA::ORB_ptr orb) :SALOMEDS_SObject_i(theImpl, orb) {} @@ -77,8 +62,8 @@ SALOMEDS_SComponent_i::~SALOMEDS_SComponent_i() char* SALOMEDS_SComponent_i::ComponentDataType() { SALOMEDS::Locker lock; - TCollection_AsciiString aType = Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentDataType(); - return CORBA::string_dup(aType.ToCString()); + string aType = dynamic_cast(_impl)->ComponentDataType(); + return CORBA::string_dup(aType.c_str()); } @@ -90,11 +75,11 @@ char* SALOMEDS_SComponent_i::ComponentDataType() CORBA::Boolean SALOMEDS_SComponent_i::ComponentIOR(CORBA::String_out IOR) { SALOMEDS::Locker lock; - TCollection_AsciiString ior; - if(!Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentIOR(ior)) { + string ior; + if(!dynamic_cast(_impl)->ComponentIOR(ior)) { IOR = CORBA::string_dup(""); return false; } - IOR = CORBA::string_dup(ior.ToCString()); + IOR = CORBA::string_dup(ior.c_str()); return true; } diff --git a/src/SALOMEDS/SALOMEDS_SComponent_i.hxx b/src/SALOMEDS/SALOMEDS_SComponent_i.hxx index 9fe9644a2..4a6d2d5cf 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponent_i.hxx @@ -43,9 +43,9 @@ class Standard_EXPORT SALOMEDS_SComponent_i: public POA_SALOMEDS::SComponent, public: - static SALOMEDS::SComponent_ptr New(const Handle(SALOMEDSImpl_SComponent)&, CORBA::ORB_ptr); + static SALOMEDS::SComponent_ptr New(const SALOMEDSImpl_SComponent&, CORBA::ORB_ptr); - SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)&, CORBA::ORB_ptr); + SALOMEDS_SComponent_i(const SALOMEDSImpl_SComponent&, CORBA::ORB_ptr); virtual ~SALOMEDS_SComponent_i(); diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index 3888f4002..b7b6e7410 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -22,8 +22,6 @@ // Module : SALOME #include -#include -#include #include "SALOMEDS_SObject.hxx" @@ -76,11 +74,18 @@ SALOMEDS_SObject::SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject) init_orb(); } -SALOMEDS_SObject::SALOMEDS_SObject(const Handle(SALOMEDSImpl_SObject)& theSObject) +SALOMEDS_SObject::SALOMEDS_SObject(const SALOMEDSImpl_SObject& theSObject) :_isLocal(true) { _corba_impl = SALOMEDS::SObject::_nil(); - _local_impl = theSObject; + + if(theSObject.IsComponent()) { + SALOMEDSImpl_SComponent sco = theSObject; + _local_impl = sco.GetPersistentCopy(); + } + else { + _local_impl = theSObject.GetPersistentCopy(); + } init_orb(); } @@ -90,6 +95,9 @@ SALOMEDS_SObject::~SALOMEDS_SObject() if (!_isLocal) { _corba_impl->Destroy(); } + else { + if(_local_impl) delete _local_impl; + } } std::string SALOMEDS_SObject::GetID() @@ -97,7 +105,7 @@ std::string SALOMEDS_SObject::GetID() std::string aValue; if (_isLocal) { SALOMEDS::Locker lock; - aValue = _local_impl->GetID().ToCString(); + aValue = _local_impl->GetID(); } else aValue = _corba_impl->GetID(); return aValue; @@ -107,9 +115,7 @@ _PTR(SComponent) SALOMEDS_SObject::GetFatherComponent() { if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aSCO = - Handle(SALOMEDSImpl_SComponent)::DownCast(_local_impl->GetFatherComponent()); - return _PTR(SComponent)(new SALOMEDS_SComponent(aSCO)); + return _PTR(SComponent)(new SALOMEDS_SComponent(_local_impl->GetFatherComponent())); } return _PTR(SComponent)(new SALOMEDS_SComponent(_corba_impl->GetFatherComponent())); } @@ -129,9 +135,12 @@ bool SALOMEDS_SObject::FindAttribute(_PTR(GenericAttribute)& anAttribute, bool ret = false; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_GenericAttribute) anAttr; - ret = _local_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute.c_str()); - if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(anAttr)); + DF_Attribute* anAttr = NULL; + ret = _local_impl->FindAttribute(anAttr, aTypeOfAttribute); + if(ret) { + SALOMEDSImpl_GenericAttribute* ga = dynamic_cast(anAttr); + anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(ga)); + } } else { SALOMEDS::GenericAttribute_var anAttr; @@ -147,7 +156,7 @@ bool SALOMEDS_SObject::ReferencedObject(_PTR(SObject)& theObject) bool ret = false; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO; + SALOMEDSImpl_SObject aSO; ret = _local_impl->ReferencedObject(aSO); if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO)); } @@ -166,7 +175,7 @@ bool SALOMEDS_SObject::FindSubObject(int theTag, _PTR(SObject)& theObject) bool ret = false; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO; + SALOMEDSImpl_SObject aSO; ret = _local_impl->FindSubObject(theTag, aSO); if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO)); } @@ -193,7 +202,7 @@ std::string SALOMEDS_SObject::Name() std::string aName; if (_isLocal) { SALOMEDS::Locker lock; - aName = _local_impl->Name().ToCString(); + aName = _local_impl->Name(); } else aName = _corba_impl->Name(); @@ -204,7 +213,7 @@ void SALOMEDS_SObject::Name(const std::string& theName) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->Name((char*)theName.c_str()); + _local_impl->Name(theName); } else _corba_impl->Name(theName.c_str()); } @@ -217,11 +226,10 @@ vector<_PTR(GenericAttribute)> SALOMEDS_SObject::GetAllAttributes() if (_isLocal) { SALOMEDS::Locker lock; - 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))); + vector aSeq = _local_impl->GetAllAttributes(); + aLength = aSeq.size(); + for (int i = 0; i < aLength; i++) { + anAttr = SALOMEDS_GenericAttribute::CreateAttribute(dynamic_cast(aSeq[i])); aVector.push_back(_PTR(GenericAttribute)(anAttr)); } } @@ -242,7 +250,7 @@ std::string SALOMEDS_SObject::GetName() std::string aName; if (_isLocal) { SALOMEDS::Locker lock; - aName = _local_impl->GetName().ToCString(); + aName = _local_impl->GetName(); } else aName = _corba_impl->GetName(); @@ -254,7 +262,7 @@ std::string SALOMEDS_SObject::GetComment() std::string aComment; if (_isLocal) { SALOMEDS::Locker lock; - aComment = _local_impl->GetComment().ToCString(); + aComment = _local_impl->GetComment(); } else aComment = _corba_impl->GetComment(); @@ -266,7 +274,7 @@ std::string SALOMEDS_SObject::GetIOR() std::string anIOR; if (_isLocal) { SALOMEDS::Locker lock; - anIOR = _local_impl->GetIOR().ToCString(); + anIOR = _local_impl->GetIOR(); } else anIOR = _corba_impl->GetIOR(); @@ -313,7 +321,7 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject::GetSObject() { if(_isLocal) { if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SObject::_duplicate(_corba_impl); - SALOMEDS::SObject_var aSO = SALOMEDS_SObject_i::New(_local_impl, _orb); + SALOMEDS::SObject_var aSO = SALOMEDS_SObject_i::New(*_local_impl, _orb); _corba_impl = SALOMEDS::SObject::_duplicate(aSO); return aSO._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_SObject.hxx b/src/SALOMEDS/SALOMEDS_SObject.hxx index efc13e827..90ea579cb 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject.hxx @@ -40,14 +40,14 @@ class Standard_EXPORT SALOMEDS_SObject: public virtual SALOMEDSClient_SObject protected: bool _isLocal; - Handle(SALOMEDSImpl_SObject) _local_impl; + 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); + SALOMEDS_SObject(const SALOMEDSImpl_SObject& theSObject); virtual ~SALOMEDS_SObject(); virtual std::string GetID(); @@ -59,7 +59,7 @@ public: virtual _PTR(Study) GetStudy(); virtual std::string Name(); virtual void Name(const std::string& theName); - virtual vector<_PTR(GenericAttribute)> GetAllAttributes(); + virtual std::vector<_PTR(GenericAttribute)> GetAllAttributes(); virtual std::string GetName(); virtual std::string GetComment(); virtual std::string GetIOR(); @@ -70,7 +70,7 @@ public: SALOMEDS::SObject_ptr GetSObject(); SALOMEDS::SObject_ptr GetCORBAImpl() { return SALOMEDS::SObject::_duplicate(_corba_impl); } - Handle(SALOMEDSImpl_SObject) GetLocalImpl() { return _local_impl; } + SALOMEDSImpl_SObject* GetLocalImpl() { return _local_impl; } private: void init_orb(); diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index 59b0e30a0..9af322638 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -34,10 +34,6 @@ #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_AttributeIOR.hxx" -// OCC Headers -#include -#include -#include #include #ifdef WIN32 @@ -51,7 +47,7 @@ using namespace std; -SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const Handle(SALOMEDSImpl_SObject)& theImpl, CORBA::ORB_ptr theORB) +SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const 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()); @@ -65,9 +61,17 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const Handle(SALOMEDSImpl_SObject) * Purpose : */ //============================================================================ -SALOMEDS_SObject_i::SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)& impl, CORBA::ORB_ptr orb) - : _impl(impl) +SALOMEDS_SObject_i::SALOMEDS_SObject_i(const SALOMEDSImpl_SObject& impl, CORBA::ORB_ptr orb) { + if(!impl.IsNull()) { + if(impl.IsComponent()) { + SALOMEDSImpl_SComponent sco = impl; + _impl = sco.GetPersistentCopy(); + } + else { + _impl = impl.GetPersistentCopy(); + } + } _orb = CORBA::ORB::_duplicate(orb); //SALOME::GenericObj_i::myPOA = SALOMEDS_StudyManager_i::GetPOA(GetStudy()); } @@ -79,7 +83,9 @@ SALOMEDS_SObject_i::SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)& impl, */ //============================================================================ SALOMEDS_SObject_i::~SALOMEDS_SObject_i() -{} +{ + if(_impl) delete _impl; +} //============================================================================ @@ -90,7 +96,7 @@ SALOMEDS_SObject_i::~SALOMEDS_SObject_i() char* SALOMEDS_SObject_i::GetID() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->GetID().ToCString()); + return CORBA::string_dup(_impl->GetID().c_str()); } //============================================================================ @@ -125,14 +131,14 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::GetFather() SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudy = _impl->GetStudy(); - if(aStudy.IsNull()) { + SALOMEDSImpl_Study* aStudy = _impl->GetStudy(); + if(!aStudy) { MESSAGE("Problem GetStudy"); return SALOMEDS::Study::_nil(); } - TCollection_AsciiString IOR = aStudy->GetTransientReference(); - CORBA::Object_var obj = _orb->string_to_object(IOR.ToCString()); + string IOR = aStudy->GetTransientReference(); + CORBA::Object_var obj = _orb->string_to_object(IOR.c_str()); SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(obj) ; ASSERT(!CORBA::is_nil(Study)); return SALOMEDS::Study::_duplicate(Study); @@ -147,13 +153,13 @@ CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out const char* aTypeOfAttribute) { SALOMEDS::Locker lock; - Handle(TDF_Attribute) anAttr; + DF_Attribute* anAttr = NULL; if(_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute)) { anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); - return Standard_True; + return true; } - return Standard_False; + return false; } //============================================================================ @@ -165,19 +171,19 @@ CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes() { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) aSeq = _impl->GetAllAttributes(); + vector aSeq = _impl->GetAllAttributes(); SALOMEDS::ListOfAttributes_var SeqOfAttr = new SALOMEDS::ListOfAttributes; - Standard_Integer length = aSeq->Length(); + int length = aSeq.size(); SeqOfAttr->length(length); if (length != 0) { - for(int i = 1; i<= length; i++) { - Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i)); + for(int i = 0; i < length; i++) { + SALOMEDSImpl_GenericAttribute* anAttr = dynamic_cast(aSeq[i]); SALOMEDS::GenericAttribute_var anAttribute; anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); if (!CORBA::is_nil(anAttribute)) { - SeqOfAttr[i - 1] = anAttribute; + SeqOfAttr[i] = anAttribute; } } } @@ -193,7 +199,7 @@ SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes() CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aRefObj; + SALOMEDSImpl_SObject aRefObj; if(!_impl->ReferencedObject(aRefObj)) return false; obj = SALOMEDS_SObject_i::New (aRefObj, _orb); @@ -208,7 +214,7 @@ CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj) CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(CORBA::Long atag, SALOMEDS::SObject_out obj) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSubObj; + SALOMEDSImpl_SObject aSubObj; if(!_impl->FindSubObject(atag, aSubObj)) return false; obj = SALOMEDS_SObject_i::New (aSubObj, _orb); @@ -224,7 +230,7 @@ CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(CORBA::Long atag, SALOMEDS::SOb char* SALOMEDS_SObject_i::Name() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->Name().ToCString()); + return CORBA::string_dup(_impl->Name().c_str()); } //============================================================================ @@ -235,7 +241,7 @@ char* SALOMEDS_SObject_i::Name() void SALOMEDS_SObject_i::Name(const char* name) { SALOMEDS::Locker lock; - TCollection_AsciiString aName((char*)name); + string aName((char*)name); _impl->Name(aName); } @@ -271,8 +277,8 @@ 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()); + string IOR = _impl->GetIOR(); + char* c_ior = CORBA::string_dup(IOR.c_str()); obj = _orb->string_to_object(c_ior); CORBA::string_free(c_ior); } catch(...) {} @@ -287,7 +293,7 @@ CORBA::Object_ptr SALOMEDS_SObject_i::GetObject() char* SALOMEDS_SObject_i::GetName() { SALOMEDS::Locker lock; - CORBA::String_var aStr = CORBA::string_dup(_impl->GetName().ToCString()); + CORBA::String_var aStr = CORBA::string_dup(_impl->GetName().c_str()); return aStr._retn(); } @@ -299,7 +305,7 @@ char* SALOMEDS_SObject_i::GetName() char* SALOMEDS_SObject_i::GetComment() { SALOMEDS::Locker lock; - CORBA::String_var aStr = CORBA::string_dup(_impl->GetComment().ToCString()); + CORBA::String_var aStr = CORBA::string_dup(_impl->GetComment().c_str()); return aStr._retn(); } @@ -311,7 +317,7 @@ char* SALOMEDS_SObject_i::GetComment() char* SALOMEDS_SObject_i::GetIOR() { SALOMEDS::Locker lock; - CORBA::String_var aStr = CORBA::string_dup(_impl->GetIOR().ToCString()); + CORBA::String_var aStr = CORBA::string_dup(_impl->GetIOR().c_str()); return aStr._retn(); } @@ -326,6 +332,5 @@ CORBA::LongLong SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA: long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - SALOMEDSImpl_SObject* local_impl = _impl.operator->(); - return ((CORBA::LongLong)local_impl); + return ((CORBA::LongLong)(void*)_impl); } diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index b836a2bee..dfab13cba 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -40,14 +40,14 @@ class Standard_EXPORT SALOMEDS_SObject_i: public virtual POA_SALOMEDS::SObject, public virtual SALOME::GenericObj_i { protected: - CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_SObject) _impl; + CORBA::ORB_ptr _orb; + SALOMEDSImpl_SObject* _impl; public: - static SALOMEDS::SObject_ptr New(const Handle(SALOMEDSImpl_SObject)&, CORBA::ORB_ptr); + static SALOMEDS::SObject_ptr New(const SALOMEDSImpl_SObject&, CORBA::ORB_ptr); - SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)&, CORBA::ORB_ptr); + SALOMEDS_SObject_i(const SALOMEDSImpl_SObject&, CORBA::ORB_ptr); virtual ~SALOMEDS_SObject_i(); diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl b/src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl deleted file mode 100644 index 34e2734ce..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cdl +++ /dev/null @@ -1,74 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx deleted file mode 100644 index d11bc86c5..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SelectableAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SelectableAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SelectableAttribute::GetID () -{ - static Standard_GUID SALOMEDS_SelectableAttributeID ("12837188-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_SelectableAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_SelectableAttribute) SALOMEDS_SelectableAttribute::Set (const TDF_Label& L, - const Standard_Integer value) -{ - Handle(SALOMEDS_SelectableAttribute) A; - if (!L.FindAttribute(SALOMEDS_SelectableAttribute::GetID(),A)) { - A = new SALOMEDS_SelectableAttribute(); - L.AddAttribute(A); - } - - (Handle(TDataStd_Integer)::DownCast(A))->Set (value); - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_SelectableAttribute::SALOMEDS_SelectableAttribute() -{ - TDataStd_Integer::Set(0); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SelectableAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_SelectableAttribute::NewEmpty () const -{ - return new SALOMEDS_SelectableAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_SelectableAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get (); - TDataStd_Integer::Set(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_SelectableAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_Integer)::DownCast (into)->Set (Get()); -} - diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx deleted file mode 100644 index ed7f98067..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.hxx +++ /dev/null @@ -1,127 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SelectableAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_SelectableAttribute_HeaderFile -#define _SALOMEDS_SelectableAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_SelectableAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_SelectableAttribute : public TDataStd_Integer { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_SelectableAttribute Set(const TDF_Label& label,const Standard_Integer value) ; -Standard_EXPORT SALOMEDS_SelectableAttribute(); -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 ~SALOMEDS_SelectableAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SelectableAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx deleted file mode 100644 index b9a76ce19..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SelectableAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SelectableAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_SelectableAttribute::~SALOMEDS_SelectableAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_SelectableAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SelectableAttribute", - sizeof(SALOMEDS_SelectableAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_SelectableAttribute) Handle(SALOMEDS_SelectableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_SelectableAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SelectableAttribute))) { - _anOtherObject = Handle(SALOMEDS_SelectableAttribute)((Handle(SALOMEDS_SelectableAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_SelectableAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_SelectableAttribute) ; -} -Standard_Boolean SALOMEDS_SelectableAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_SelectableAttribute) == AType || TDataStd_Integer::IsKind(AType)); -} -Handle_SALOMEDS_SelectableAttribute::~Handle_SALOMEDS_SelectableAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx b/src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx deleted file mode 100644 index 5538e42ab..000000000 --- a/src/SALOMEDS/SALOMEDS_SelectableAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SelectableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_SelectableAttribute_HeaderFile -#include "SALOMEDS_SelectableAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl deleted file mode 100644 index 7f7a703d9..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cdl +++ /dev/null @@ -1,101 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_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 th element of the sequence to - - 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 - - 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; diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx deleted file mode 100644 index ceb6a42d9..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.cxx +++ /dev/null @@ -1,151 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfIntegerAttribute.ixx" -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::GetID () -{ - static Standard_GUID SALOMEDS_SequenceOfIntegerAttributeID ("12837182-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_SequenceOfIntegerAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_SequenceOfIntegerAttribute) SALOMEDS_SequenceOfIntegerAttribute::Set (const TDF_Label& L) -{ - Handle(SALOMEDS_SequenceOfIntegerAttribute) A; - if (!L.FindAttribute(SALOMEDS_SequenceOfIntegerAttribute::GetID(),A)) { - A = new SALOMEDS_SequenceOfIntegerAttribute(); - L.AddAttribute(A); - } - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_SequenceOfIntegerAttribute::SALOMEDS_SequenceOfIntegerAttribute() -{myValue = new TColStd_HSequenceOfInteger();} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_SequenceOfIntegerAttribute::NewEmpty () const -{ - return new SALOMEDS_SequenceOfIntegerAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_SequenceOfIntegerAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer i; - Handle(SALOMEDS_SequenceOfIntegerAttribute) anSeq = Handle(SALOMEDS_SequenceOfIntegerAttribute)::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 SALOMEDS_SequenceOfIntegerAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const -{ - if(!myValue.IsNull()) { - Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast (into)->Assign(myValue); - } -} - -void SALOMEDS_SequenceOfIntegerAttribute::Assign(const Handle(TColStd_HSequenceOfInteger)& other) -{ - Backup(); - if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger; - myValue->ChangeSequence() = other->Sequence(); -} - -void SALOMEDS_SequenceOfIntegerAttribute::ChangeValue(const Standard_Integer Index,const Standard_Integer Value) -{ - Backup(); - myValue->SetValue(Index, Value); -} - -void SALOMEDS_SequenceOfIntegerAttribute::Add(const Standard_Integer Value) -{ - Backup(); - myValue->Append(Value); -} - -void SALOMEDS_SequenceOfIntegerAttribute::Remove(const Standard_Integer Index) -{ - Backup(); - myValue->Remove(Index); -} - -Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Length() -{ - return myValue->Length(); -} -Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Value(const Standard_Integer Index) -{ - return myValue->Value(Index); -} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx deleted file mode 100644 index 9092ad439..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#define _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfInteger; -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_SequenceOfIntegerAttribute : public TDF_Attribute { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_SequenceOfIntegerAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_SequenceOfIntegerAttribute(); -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 ~SALOMEDS_SequenceOfIntegerAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SequenceOfIntegerAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Handle_TColStd_HSequenceOfInteger myValue; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx deleted file mode 100644 index 6c17e84e8..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.ixx +++ /dev/null @@ -1,85 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfIntegerAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_SequenceOfIntegerAttribute::~SALOMEDS_SequenceOfIntegerAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_SequenceOfIntegerAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SequenceOfIntegerAttribute", - sizeof(SALOMEDS_SequenceOfIntegerAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_SequenceOfIntegerAttribute) Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_SequenceOfIntegerAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute))) { - _anOtherObject = Handle(SALOMEDS_SequenceOfIntegerAttribute)((Handle(SALOMEDS_SequenceOfIntegerAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_SequenceOfIntegerAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute) ; -} -Standard_Boolean SALOMEDS_SequenceOfIntegerAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_SequenceOfIntegerAttribute::~Handle_SALOMEDS_SequenceOfIntegerAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx b/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx deleted file mode 100644 index 6056e3645..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfIntegerAttribute.jxx +++ /dev/null @@ -1,46 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfIntegerAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile -#include "SALOMEDS_SequenceOfIntegerAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl deleted file mode 100644 index f0a84c32d..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cdl +++ /dev/null @@ -1,100 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_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 th element of the sequence to - - 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 - - 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; diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx deleted file mode 100644 index c3c4bcf21..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.cxx +++ /dev/null @@ -1,153 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfRealAttribute.ixx" -#include -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::GetID () -{ - static Standard_GUID SALOMEDS_SequenceOfRealAttributeID ("12837183-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_SequenceOfRealAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_SequenceOfRealAttribute) SALOMEDS_SequenceOfRealAttribute::Set (const TDF_Label& L) -{ - Handle(SALOMEDS_SequenceOfRealAttribute) A; - if (!L.FindAttribute(SALOMEDS_SequenceOfRealAttribute::GetID(),A)) { - A = new SALOMEDS_SequenceOfRealAttribute(); - L.AddAttribute(A); - } - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_SequenceOfRealAttribute::SALOMEDS_SequenceOfRealAttribute() -{myValue = new TColStd_HSequenceOfReal();} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_SequenceOfRealAttribute::NewEmpty () const -{ - return new SALOMEDS_SequenceOfRealAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_SequenceOfRealAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer i; - Handle(SALOMEDS_SequenceOfRealAttribute) anSeq = Handle(SALOMEDS_SequenceOfRealAttribute)::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 SALOMEDS_SequenceOfRealAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const -{ - if(!myValue.IsNull()) { - Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast (into)->Assign(myValue); - } -} - -void SALOMEDS_SequenceOfRealAttribute::Assign(const Handle(TColStd_HSequenceOfReal)& other) -{ - Backup(); - if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal; - myValue->ChangeSequence() = other->Sequence(); -} - -void SALOMEDS_SequenceOfRealAttribute::ChangeValue(const Standard_Integer Index,const Standard_Real Value) -{ - Backup(); - myValue->SetValue(Index, Value); -} - -void SALOMEDS_SequenceOfRealAttribute::Add(const Standard_Real Value) -{ - Backup(); - myValue->Append(Value); -} - -void SALOMEDS_SequenceOfRealAttribute::Remove(const Standard_Integer Index) -{ - Backup(); - myValue->Remove(Index); -} - -Standard_Integer SALOMEDS_SequenceOfRealAttribute::Length() -{ - return myValue->Length(); -} - -Standard_Real SALOMEDS_SequenceOfRealAttribute::Value(const Standard_Integer Index) -{ - return myValue->Value(Index); -} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx deleted file mode 100644 index b296f628e..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.hxx +++ /dev/null @@ -1,137 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_SequenceOfRealAttribute_HeaderFile -#define _SALOMEDS_SequenceOfRealAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_SequenceOfRealAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfReal_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Real_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfReal; -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_SequenceOfRealAttribute : public TDF_Attribute { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_SequenceOfRealAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_SequenceOfRealAttribute(); -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 ~SALOMEDS_SequenceOfRealAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SequenceOfRealAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Handle_TColStd_HSequenceOfReal myValue; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx deleted file mode 100644 index 28af33323..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.ixx +++ /dev/null @@ -1,85 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_SequenceOfRealAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_SequenceOfRealAttribute::~SALOMEDS_SequenceOfRealAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_SequenceOfRealAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SequenceOfRealAttribute", - sizeof(SALOMEDS_SequenceOfRealAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_SequenceOfRealAttribute) Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_SequenceOfRealAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute))) { - _anOtherObject = Handle(SALOMEDS_SequenceOfRealAttribute)((Handle(SALOMEDS_SequenceOfRealAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_SequenceOfRealAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute) ; -} -Standard_Boolean SALOMEDS_SequenceOfRealAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_SequenceOfRealAttribute::~Handle_SALOMEDS_SequenceOfRealAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx b/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx deleted file mode 100644 index 07670a1d7..000000000 --- a/src/SALOMEDS/SALOMEDS_SequenceOfRealAttribute.jxx +++ /dev/null @@ -1,46 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_SequenceOfRealAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfReal_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_SequenceOfRealAttribute_HeaderFile -#include "SALOMEDS_SequenceOfRealAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx index 397f39772..b2d2dd913 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -56,11 +56,9 @@ int main(int argc, char** argv) { // Initialise the ORB. #if OMNIORB_VERSION >= 4 - const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } }; - CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ; + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ; #else - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3"); - omniORB::MaxMessageSize(100 * 1024 * 1024); + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" ); #endif // Obtain a reference to the root POA. long TIMESleep = 500000000; diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index 3dca6b26d..0aa3a240d 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -49,10 +49,6 @@ #include "SALOMEDS_Driver_i.hxx" #include "SALOMEDS_Study_i.hxx" -#include -#include -#include - #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" @@ -67,7 +63,7 @@ using namespace std; -SALOMEDS_Study::SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy) +SALOMEDS_Study::SALOMEDS_Study(SALOMEDSImpl_Study* theStudy) { _isLocal = true; _local_impl = theStudy; @@ -105,7 +101,7 @@ std::string SALOMEDS_Study::GetPersistentReference() std::string aRef; if (_isLocal) { SALOMEDS::Locker lock; - aRef = _local_impl->GetPersistentReference().ToCString(); + aRef = _local_impl->GetPersistentReference(); } else aRef = _corba_impl->GetPersistentReference(); return aRef; @@ -116,7 +112,7 @@ std::string SALOMEDS_Study::GetTransientReference() std::string aRef; if (_isLocal) { SALOMEDS::Locker lock; - aRef = _local_impl->GetTransientReference().ToCString(); + aRef = _local_impl->GetTransientReference(); } else aRef = _corba_impl->GetTransientReference(); return aRef; @@ -139,9 +135,8 @@ _PTR(SComponent) SALOMEDS_Study::FindComponent (const std::string& aComponentNam if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aSCO_impl = - _local_impl->FindComponent((char*)aComponentName.c_str()); - if (aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO); + SALOMEDSImpl_SComponent aSCO_impl = _local_impl->FindComponent(aComponentName); + if (!aSCO_impl) return _PTR(SComponent)(aSCO); aSCO = new SALOMEDS_SComponent(aSCO_impl); } else { @@ -158,9 +153,8 @@ _PTR(SComponent) SALOMEDS_Study::FindComponentID(const std::string& aComponentID if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aSCO_impl = - _local_impl->FindComponentID((char*)aComponentID.c_str()); - if (aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO); + SALOMEDSImpl_SComponent aSCO_impl = _local_impl->FindComponentID(aComponentID); + if (!aSCO_impl) return _PTR(SComponent)(aSCO); aSCO = new SALOMEDS_SComponent(aSCO_impl); } else { @@ -178,10 +172,12 @@ _PTR(SObject) SALOMEDS_Study::FindObject(const std::string& anObjectName) if (_isLocal) { SALOMEDS::Locker lock; - 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)); + SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObject(anObjectName); + if (!aSO_impl) return _PTR(SObject)(aSO); + if(aSO_impl.IsComponent()) { + SALOMEDSImpl_SComponent aSCO_impl = aSO_impl; + return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl)); + } aSO = new SALOMEDS_SObject(aSO_impl); } else { @@ -204,12 +200,10 @@ std::vector<_PTR(SObject)> SALOMEDS_Study::FindObjectByName(const std::string& a if (_isLocal) { SALOMEDS::Locker lock; - 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))))); + vector aSeq = _local_impl->FindObjectByName(anObjectName, aComponentName); + aLength = aSeq.size(); + for (i = 0; i< aLength; i++) + aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i]))); } else { SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindObjectByName((char*)anObjectName.c_str(), @@ -227,8 +221,8 @@ _PTR(SObject) SALOMEDS_Study::FindObjectID(const std::string& anObjectID) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectID((char*)anObjectID.c_str()); - if(aSO_impl.IsNull()) return _PTR(SObject)(aSO); + SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObjectID(anObjectID); + if(!aSO_impl) return _PTR(SObject)(aSO); return _PTR(SObject)(new SALOMEDS_SObject(aSO_impl)); } else { @@ -244,8 +238,8 @@ _PTR(SObject) SALOMEDS_Study::CreateObjectID(const std::string& anObjectID) SALOMEDSClient_SObject* aSO = NULL; if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->CreateObjectID((char*)anObjectID.c_str()); - if(aSO_impl.IsNull()) return _PTR(SObject)(aSO); + SALOMEDSImpl_SObject aSO_impl = _local_impl->CreateObjectID(anObjectID); + if(!aSO_impl) return _PTR(SObject)(aSO); aSO = new SALOMEDS_SObject(aSO_impl); } else { @@ -262,8 +256,8 @@ _PTR(SObject) SALOMEDS_Study::FindObjectIOR(const std::string& anObjectIOR) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectIOR((char*)anObjectIOR.c_str()); - if (aSO_impl.IsNull()) return _PTR(SObject)(aSO); + SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObjectIOR(anObjectIOR); + if (!aSO_impl) return _PTR(SObject)(aSO); aSO = new SALOMEDS_SObject(aSO_impl); } else { @@ -280,8 +274,8 @@ _PTR(SObject) SALOMEDS_Study::FindObjectByPath(const std::string& thePath) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectByPath((char*)thePath.c_str()); - if (aSO_impl.IsNull()) return _PTR(SObject)(aSO); + SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObjectByPath(thePath); + if (!aSO_impl) return _PTR(SObject)(aSO); aSO = new SALOMEDS_SObject(aSO_impl); } else { @@ -299,7 +293,7 @@ std::string SALOMEDS_Study::GetObjectPath(const _PTR(SObject)& theSO) std::string aPath; if (_isLocal) { SALOMEDS::Locker lock; - aPath = _local_impl->GetObjectPath(aSO->GetLocalImpl()).ToCString(); + aPath = _local_impl->GetObjectPath(*(aSO->GetLocalImpl())); } else aPath = _corba_impl->GetObjectPath(aSO->GetCORBAImpl()); return aPath; @@ -309,7 +303,7 @@ void SALOMEDS_Study::SetContext(const std::string& thePath) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->SetContext((char*)thePath.c_str()); + _local_impl->SetContext(thePath); } else _corba_impl->SetContext((char*)thePath.c_str()); } @@ -319,7 +313,7 @@ std::string SALOMEDS_Study::GetContext() std::string aPath; if (_isLocal) { SALOMEDS::Locker lock; - aPath = _local_impl->GetContext().ToCString(); + aPath = _local_impl->GetContext(); } else aPath = _corba_impl->GetContext(); return aPath; @@ -331,10 +325,7 @@ std::vector SALOMEDS_Study::GetObjectNames(const std::string& theCo int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - 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()); + aVector = _local_impl->GetObjectNames(theContext); } else { SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetObjectNames((char*)theContext.c_str()); @@ -350,11 +341,7 @@ std::vector SALOMEDS_Study::GetDirectoryNames(const std::string& th int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - 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()); + aVector = _local_impl->GetDirectoryNames(theContext); } else { SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetDirectoryNames((char*)theContext.c_str()); @@ -370,10 +357,7 @@ std::vector SALOMEDS_Study::GetFileNames(const std::string& theCont int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - 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()); + aVector = _local_impl->GetFileNames(theContext); } else { SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetFileNames((char*)theContext.c_str()); @@ -390,10 +374,7 @@ std::vector SALOMEDS_Study::GetComponentNames(const std::string& th int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - 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()); + aVector = _local_impl->GetComponentNames(theContext); } else { SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetComponentNames((char*)theContext.c_str()); @@ -409,8 +390,7 @@ _PTR(ChildIterator) SALOMEDS_Study::NewChildIterator(const _PTR(SObject)& theSO) SALOMEDSClient_ChildIterator* aCI = NULL; if (_isLocal) { SALOMEDS::Locker lock; - - Handle(SALOMEDSImpl_ChildIterator) aCIimpl = _local_impl->NewChildIterator(aSO->GetLocalImpl()); + SALOMEDSImpl_ChildIterator aCIimpl = _local_impl->NewChildIterator(*(aSO->GetLocalImpl())); aCI = new SALOMEDS_ChildIterator(aCIimpl); } else { @@ -444,7 +424,7 @@ _PTR(StudyBuilder) SALOMEDS_Study::NewBuilder() if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_StudyBuilder) aSBimpl = _local_impl->NewBuilder(); + SALOMEDSImpl_StudyBuilder* aSBimpl = _local_impl->NewBuilder(); aSB = new SALOMEDS_StudyBuilder(aSBimpl); } else { @@ -460,7 +440,7 @@ std::string SALOMEDS_Study::Name() std::string aName; if (_isLocal) { SALOMEDS::Locker lock; - aName = _local_impl->Name().ToCString(); + aName = _local_impl->Name(); } else aName = _corba_impl->Name(); return aName; @@ -470,7 +450,7 @@ void SALOMEDS_Study::Name(const std::string& theName) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->Name((char*)theName.c_str()); + _local_impl->Name(theName); } else _corba_impl->Name((char*)theName.c_str()); } @@ -512,7 +492,7 @@ void SALOMEDS_Study::Modified() SALOMEDS::Locker lock; _local_impl->Modify(); } - else _corba_impl->IsModified(); + else _corba_impl->Modified(); } @@ -521,7 +501,7 @@ std::string SALOMEDS_Study::URL() std::string aURL; if (_isLocal) { SALOMEDS::Locker lock; - aURL = _local_impl->URL().ToCString(); + aURL = _local_impl->URL(); } else aURL = _corba_impl->URL(); return aURL; @@ -531,7 +511,7 @@ void SALOMEDS_Study::URL(const std::string& url) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->URL((char*)url.c_str()); + _local_impl->URL(url); } else _corba_impl->URL((char*)url.c_str()); } @@ -564,12 +544,11 @@ std::vector<_PTR(SObject)> SALOMEDS_Study::FindDependances(const _PTR(SObject)& if (_isLocal) { SALOMEDS::Locker lock; - 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))))); + vector aSeq = _local_impl->FindDependances(*(aSO->GetLocalImpl())); + if (aSeq.size()) { + aLength = aSeq.size(); + for (i = 0; i < aLength; i++) + aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i]))); } } else { @@ -596,7 +575,7 @@ std::string SALOMEDS_Study::GetLastModificationDate() std::string aDate; if (_isLocal) { SALOMEDS::Locker lock; - aDate = _local_impl->GetLastModificationDate().ToCString(); + aDate = _local_impl->GetLastModificationDate(); } else aDate = _corba_impl->GetLastModificationDate(); return aDate; @@ -608,10 +587,7 @@ std::vector SALOMEDS_Study::GetModificationsDate() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetModificationsDate(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + aVector = _local_impl->GetModificationsDate(); } else { SALOMEDS::ListOfDates_var aSeq = _corba_impl->GetModificationsDate(); @@ -627,7 +603,7 @@ _PTR(UseCaseBuilder) SALOMEDS_Study::GetUseCaseBuilder() if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_UseCaseBuilder) aUBimpl = _local_impl->GetUseCaseBuilder(); + SALOMEDSImpl_UseCaseBuilder* aUBimpl = _local_impl->GetUseCaseBuilder(); aUB = new SALOMEDS_UseCaseBuilder(aUBimpl); } else { @@ -665,7 +641,7 @@ void SALOMEDS_Study::SetStudyLock(const string& theLockerID) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->SetStudyLock((char*)theLockerID.c_str()); + _local_impl->SetStudyLock(theLockerID.c_str()); } else _corba_impl->SetStudyLock((char*)theLockerID.c_str()); } @@ -683,7 +659,7 @@ bool SALOMEDS_Study::IsStudyLocked() void SALOMEDS_Study::UnLockStudy(const string& theLockerID) { - if(_isLocal) _local_impl->UnLockStudy((char*)theLockerID.c_str()); + if(_isLocal) _local_impl->UnLockStudy(theLockerID.c_str()); else _corba_impl->UnLockStudy((char*)theLockerID.c_str()); } @@ -693,10 +669,7 @@ vector SALOMEDS_Study::GetLockerID() int aLength, i; if (_isLocal) { SALOMEDS::Locker lock; - - Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetLockerID(); - aLength = aSeq->Length(); - for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString()); + aVector = _local_impl->GetLockerID(); } else { SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetLockerID(); @@ -729,7 +702,7 @@ SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy() SALOMEDS::Locker lock; if (!CORBA::is_nil(_corba_impl)) return SALOMEDS::Study::_duplicate(_corba_impl); - std::string anIOR = _local_impl->GetTransientReference().ToCString(); + std::string anIOR = _local_impl->GetTransientReference(); SALOMEDS::Study_var aStudy; if (!_local_impl->IsError() && anIOR != "") { aStudy = SALOMEDS::Study::_narrow(_orb->string_to_object(anIOR.c_str())); diff --git a/src/SALOMEDS/SALOMEDS_Study.hxx b/src/SALOMEDS/SALOMEDS_Study.hxx index 41e40902a..e893ce684 100644 --- a/src/SALOMEDS/SALOMEDS_Study.hxx +++ b/src/SALOMEDS/SALOMEDS_Study.hxx @@ -39,13 +39,13 @@ class Standard_EXPORT SALOMEDS_Study: public SALOMEDSClient_Study private: bool _isLocal; - Handle(SALOMEDSImpl_Study) _local_impl; + SALOMEDSImpl_Study* _local_impl; SALOMEDS::Study_var _corba_impl; CORBA::ORB_var _orb; public: - SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy); + SALOMEDS_Study(SALOMEDSImpl_Study* theStudy); SALOMEDS_Study(SALOMEDS::Study_ptr theStudy); ~SALOMEDS_Study(); diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx index 2d5a3901c..4b6da1939 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx @@ -43,8 +43,7 @@ #include #include -#include -#include +#include "DF_Attribute.hxx" #include "Utils_CorbaException.hxx" #include "Utils_ORB_INIT.hxx" @@ -52,7 +51,7 @@ using namespace std; -SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(const Handle(SALOMEDSImpl_StudyBuilder)& theBuilder) +SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(SALOMEDSImpl_StudyBuilder* theBuilder) { _isLocal = true; _local_impl = theBuilder; @@ -82,8 +81,8 @@ _PTR(SComponent) SALOMEDS_StudyBuilder::NewComponent(const std::string& Componen CheckLocked(); SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->NewComponent((char*)ComponentDataType.c_str()); - if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO); + SALOMEDSImpl_SComponent aSCO_impl =_local_impl->NewComponent(ComponentDataType); + if(!aSCO_impl) return _PTR(SComponent)(aSCO); aSCO = new SALOMEDS_SComponent(aSCO_impl); } else { @@ -105,8 +104,8 @@ void SALOMEDS_StudyBuilder::DefineComponentInstance (const _PTR(SComponent)& the CheckLocked(); SALOMEDS::Locker lock; - _local_impl->DefineComponentInstance(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()), - (char*)ComponentIOR.c_str()); + _local_impl->DefineComponentInstance(*(dynamic_cast(aSCO->GetLocalImpl())), + ComponentIOR); } else { CORBA::Object_var obj = _orb->string_to_object(ComponentIOR.c_str()); @@ -122,7 +121,7 @@ void SALOMEDS_StudyBuilder::RemoveComponent(const _PTR(SComponent)& theSCO) CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveComponent(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl())); + _local_impl->RemoveComponent(*(dynamic_cast(aSCO->GetLocalImpl()))); } else _corba_impl->RemoveComponent(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl())); } @@ -137,8 +136,8 @@ _PTR(SObject) SALOMEDS_StudyBuilder::NewObject(const _PTR(SObject)& theFatherObj if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->NewObject(father->GetLocalImpl()); - if(aSO_impl.IsNull()) return _PTR(SObject)(aSO); + SALOMEDSImpl_SObject aSO_impl = _local_impl->NewObject(*(father->GetLocalImpl())); + if(!aSO_impl) return _PTR(SObject)(aSO); aSO = new SALOMEDS_SObject(aSO_impl); } else { @@ -160,7 +159,7 @@ _PTR(SObject) SALOMEDS_StudyBuilder::NewObjectToTag(const _PTR(SObject)& theFath if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->NewObjectToTag(father->GetLocalImpl(), theTag); + SALOMEDSImpl_SObject aSO_impl = _local_impl->NewObjectToTag(*(father->GetLocalImpl()), theTag); if(aSO_impl.IsNull()) return _PTR(SObject)(aSO); aSO = new SALOMEDS_SObject(aSO_impl); } @@ -181,7 +180,7 @@ void SALOMEDS_StudyBuilder::AddDirectory(const std::string& thePath) _local_impl->AddDirectory((char*)thePath.c_str()); if (_local_impl->IsError()) { - std::string anErrorCode = _local_impl->GetErrorCode().ToCString(); + std::string anErrorCode = _local_impl->GetErrorCode(); if (anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed(); if (anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory(); if (anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent(); @@ -202,12 +201,11 @@ void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std:: SALOMEDS::Locker lock; SALOMEDS_Driver_i* drv = new SALOMEDS_Driver_i(aDriver, _orb); - Handle(SALOMEDSImpl_SComponent) aSCO_impl = - Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()); + SALOMEDSImpl_SComponent aSCO_impl = *(dynamic_cast(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); + THROW_SALOME_CORBA_EXCEPTION(_local_impl->GetErrorCode().c_str(),SALOME::BAD_PARAM); } else { _corba_impl->LoadWith(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()), aDriver); @@ -217,7 +215,7 @@ void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std:: void SALOMEDS_StudyBuilder::Load(const _PTR(SObject)& theSCO) { SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO.get()); - if (_isLocal) _local_impl->Load(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl())); + if (_isLocal) _local_impl->Load(*(dynamic_cast(aSCO->GetLocalImpl()))); else _corba_impl->Load(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl())); } @@ -230,7 +228,7 @@ void SALOMEDS_StudyBuilder::RemoveObject(const _PTR(SObject)& theSO) CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveObject(aSO->GetLocalImpl()); + _local_impl->RemoveObject(*(aSO->GetLocalImpl())); } else _corba_impl->RemoveObject(aSO->GetCORBAImpl()); } @@ -244,7 +242,7 @@ void SALOMEDS_StudyBuilder::RemoveObjectWithChildren(const _PTR(SObject)& theSO) CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveObjectWithChildren(aSO->GetLocalImpl()); + _local_impl->RemoveObjectWithChildren(*(aSO->GetLocalImpl())); } else _corba_impl->RemoveObjectWithChildren(aSO->GetCORBAImpl()); } @@ -258,10 +256,10 @@ _PTR(GenericAttribute) SALOMEDS_StudyBuilder::FindOrCreateAttribute(const _PTR(S if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_GenericAttribute) aGA; + SALOMEDSImpl_GenericAttribute* aGA; try { - aGA = Handle(SALOMEDSImpl_GenericAttribute)::DownCast - (_local_impl->FindOrCreateAttribute(aSO->GetLocalImpl(), (char*)aTypeOfAttribute.c_str())); + aGA = dynamic_cast + (_local_impl->FindOrCreateAttribute(*(aSO->GetLocalImpl()), aTypeOfAttribute)); } catch (...) { throw SALOMEDS::StudyBuilder::LockProtection(); @@ -289,9 +287,12 @@ bool SALOMEDS_StudyBuilder::FindAttribute(const _PTR(SObject)& theSO, if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_GenericAttribute) aGA; - ret = _local_impl->FindAttribute(aSO->GetLocalImpl(), aGA, (char*)aTypeOfAttribute.c_str()); - if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(aGA)); + DF_Attribute* anAttr = NULL; + ret = _local_impl->FindAttribute(*(aSO->GetLocalImpl()), anAttr, aTypeOfAttribute); + if(ret) { + SALOMEDSImpl_GenericAttribute* aGA = dynamic_cast(anAttr); + anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(aGA)); + } } else { SALOMEDS::GenericAttribute_var aGA; @@ -311,14 +312,16 @@ void SALOMEDS_StudyBuilder::RemoveAttribute(const _PTR(SObject)& theSO, const st CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveAttribute(aSO->GetLocalImpl(), (char*)aTypeOfAttribute.c_str()); + _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) { - if(!me || !thereferencedObject) return; + if(!me || !thereferencedObject) { + throw DFexception("Invalid arguments"); + } SALOMEDS_SObject* aSO = dynamic_cast(me.get()); SALOMEDS_SObject* aRefSO = dynamic_cast(thereferencedObject.get()); @@ -326,7 +329,7 @@ void SALOMEDS_StudyBuilder::Addreference(const _PTR(SObject)& me, const _PTR(SOb CheckLocked(); SALOMEDS::Locker lock; - _local_impl->Addreference(aSO->GetLocalImpl(), aRefSO->GetLocalImpl()); + _local_impl->Addreference(*(aSO->GetLocalImpl()), *(aRefSO->GetLocalImpl())); } else _corba_impl->Addreference(aSO->GetCORBAImpl(), aRefSO->GetCORBAImpl()); } @@ -339,7 +342,7 @@ void SALOMEDS_StudyBuilder::RemoveReference(const _PTR(SObject)& me) CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveReference(aSO->GetLocalImpl()); + _local_impl->RemoveReference(*(aSO->GetLocalImpl())); } else _corba_impl->RemoveReference(aSO->GetCORBAImpl()); } @@ -347,28 +350,25 @@ void SALOMEDS_StudyBuilder::RemoveReference(const _PTR(SObject)& me) void SALOMEDS_StudyBuilder::SetGUID(const _PTR(SObject)& theSO, const std::string& theGUID) { if(!theSO) return; - if(!Standard_GUID::CheckGUIDFormat((char*)theGUID.c_str())) throw invalid_argument("Invalid GUID"); SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - _local_impl->SetGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str()); + _local_impl->SetGUID(*(aSO->GetLocalImpl()), theGUID); } else _corba_impl->SetGUID(aSO->GetCORBAImpl(), (char*)theGUID.c_str()); } bool SALOMEDS_StudyBuilder::IsGUID(const _PTR(SObject)& theSO, const std::string& theGUID) { - if(!theSO || !Standard_GUID::CheckGUIDFormat((char*)theGUID.c_str())) return false; - SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->IsGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str()); + ret = _local_impl->IsGUID(*(aSO->GetLocalImpl()), (char*)theGUID.c_str()); } else ret = _corba_impl->IsGUID(aSO->GetCORBAImpl(), (char*)theGUID.c_str()); @@ -513,7 +513,7 @@ void SALOMEDS_StudyBuilder::SetName(const _PTR(SObject)& theSO, const std::strin CheckLocked(); SALOMEDS::Locker lock; - _local_impl->SetName(aSO->GetLocalImpl(), (char*)theValue.c_str()); + _local_impl->SetName(*(aSO->GetLocalImpl()), theValue); } else _corba_impl->SetName(aSO->GetCORBAImpl(), (char*)theValue.c_str()); } @@ -527,7 +527,7 @@ void SALOMEDS_StudyBuilder::SetComment(const _PTR(SObject)& theSO, const std::st CheckLocked(); SALOMEDS::Locker lock; - _local_impl->SetComment(aSO->GetLocalImpl(), (char*)theValue.c_str()); + _local_impl->SetComment(*(aSO->GetLocalImpl()), theValue); } else _corba_impl->SetComment(aSO->GetCORBAImpl(), (char*)theValue.c_str()); } @@ -541,7 +541,7 @@ void SALOMEDS_StudyBuilder::SetIOR(const _PTR(SObject)& theSO, const std::string CheckLocked(); SALOMEDS::Locker lock; - _local_impl->SetIOR(aSO->GetLocalImpl(), (char*)theValue.c_str()); + _local_impl->SetIOR(*(aSO->GetLocalImpl()), theValue); } else _corba_impl->SetIOR(aSO->GetCORBAImpl(), (char*)theValue.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx index 9ad50d1bf..a05408ae4 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx @@ -37,13 +37,13 @@ class SALOMEDS_EXPORT SALOMEDS_StudyBuilder: public SALOMEDSClient_StudyBuilder { private: bool _isLocal; - Handle(SALOMEDSImpl_StudyBuilder) _local_impl; + SALOMEDSImpl_StudyBuilder* _local_impl; SALOMEDS::StudyBuilder_var _corba_impl; CORBA::ORB_var _orb; public: - SALOMEDS_StudyBuilder(const Handle(SALOMEDSImpl_StudyBuilder)& theBuilder); + SALOMEDS_StudyBuilder(SALOMEDSImpl_StudyBuilder* theBuilder); SALOMEDS_StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuilder); ~SALOMEDS_StudyBuilder(); diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx index 6306b9858..5c5e0046b 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx @@ -38,7 +38,8 @@ #include "Utils_CorbaException.hxx" #include "Utils_ExceptHandlers.hxx" -#include +#include +#include #include using namespace std; @@ -51,7 +52,7 @@ UNEXPECT_CATCH(SBLockProtection, SALOMEDS::StudyBuilder::LockProtection); * Purpose : */ //============================================================================ -SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(const Handle(SALOMEDSImpl_StudyBuilder) theImpl, +SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(SALOMEDSImpl_StudyBuilder* theImpl, CORBA::ORB_ptr orb) { _orb = CORBA::ORB::_duplicate(orb); @@ -76,7 +77,7 @@ SALOMEDS::SComponent_ptr SALOMEDS_StudyBuilder_i::NewComponent(const char* DataT SALOMEDS::Locker lock; CheckLocked(); //char* aDataType = CORBA::string_dup(DataType); - Handle(SALOMEDSImpl_SComponent) aSCO = _impl->NewComponent(TCollection_AsciiString((char*)DataType)); + SALOMEDSImpl_SComponent aSCO = _impl->NewComponent(string(DataType)); //CORBA::free_string(aDataType); if(aSCO.IsNull()) return SALOMEDS::SComponent::_nil(); @@ -94,8 +95,7 @@ void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr a { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_SComponent) aSCO; - aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID()); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID()); CORBA::String_var iorstr = _orb->object_to_string(IOR); _impl->DefineComponentInstance(aSCO, (char*)iorstr.in()); @@ -111,8 +111,7 @@ void SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr aComponen SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(aComponent)); - Handle(SALOMEDSImpl_SComponent) aSCO; - aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID()); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID()); _impl->RemoveComponent(aSCO); } @@ -126,8 +125,8 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr t SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_SObject) aFO, aSO; - aFO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theFatherObject->GetID()); + SALOMEDSImpl_SObject aFO, aSO; + aFO = _impl->GetOwner()->GetSObject(theFatherObject->GetID()); aSO = _impl->NewObject(aFO); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO,_orb); @@ -145,8 +144,8 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyBuilder_i::NewObjectToTag(SALOMEDS::SObject_ { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_SObject) aFO, aSO; - aFO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theFatherObject->GetID()); + SALOMEDSImpl_SObject aFO, aSO; + aFO = _impl->GetOwner()->GetSObject(theFatherObject->GetID()); aSO = _impl->NewObjectToTag(aFO, atag); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); @@ -162,8 +161,7 @@ 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()); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); _impl->RemoveObject(aSO); } @@ -176,8 +174,7 @@ void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anO { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_SObject) aSO; - aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID()); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); _impl->RemoveObjectWithChildren(aSO); } @@ -192,14 +189,13 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO, SALOMEDS::Locker lock; Unexpect aCatch(SBSalomeException); - Handle(SALOMEDSImpl_SComponent) aSCO; - aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)anSCO->GetID()); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anSCO->GetID()); SALOMEDS_Driver_i* driver = new SALOMEDS_Driver_i(aDriver, _orb); - bool isDone = _impl->LoadWith(aSCO, driver); + bool isDone = _impl->LoadWith(aSCO, driver); delete driver; if(!isDone && _impl->IsError()) { - THROW_SALOME_CORBA_EXCEPTION(_impl->GetErrorCode().ToCString(),SALOME::BAD_PARAM); + THROW_SALOME_CORBA_EXCEPTION(_impl->GetErrorCode().c_str(),SALOME::BAD_PARAM); } } @@ -224,26 +220,27 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA 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; + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.inout()); + DF_Attribute* anAttr; try { - anAttr = _impl->FindOrCreateAttribute(aSO, TCollection_AsciiString((char*)aTypeOfAttribute)); + anAttr = _impl->FindOrCreateAttribute(aSO, string(aTypeOfAttribute)); } catch (...) { throw SALOMEDS::StudyBuilder::LockProtection(); } SALOMEDS::GenericAttribute_var anAttribute; - anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + + if(anAttr) + 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 + * Purpose : Find attribute of given type assigned SObject, returns true if it is found */ //============================================================================ @@ -253,11 +250,10 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr anOb { 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; + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + DF_Attribute* anAttr; - if(!_impl->FindAttribute(aSO, anAttr, TCollection_AsciiString((char*)aTypeOfAttribute))) return false; + if(!_impl->FindAttribute(aSO, anAttr, string(aTypeOfAttribute))) return false; anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); return true; @@ -275,9 +271,8 @@ void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr anObject, 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)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + _impl->RemoveAttribute(aSO, string(aTypeOfAttribute)); } //============================================================================ @@ -293,9 +288,9 @@ void SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me, 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()); + SALOMEDSImpl_SObject aSO, aRefSO; + aSO = _impl->GetOwner()->GetSObject(me->GetID()); + aRefSO = _impl->GetOwner()->GetSObject(theReferencedObject->GetID()); _impl->Addreference(aSO, aRefSO); } @@ -309,8 +304,7 @@ 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()); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(me->GetID()); _impl->RemoveReference(aSO); } @@ -325,8 +319,8 @@ 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(!_impl->AddDirectory(string(thePath))) { + string anErrorCode = _impl->GetErrorCode(); if(anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed(); if(anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory(); if(anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent(); @@ -344,9 +338,8 @@ void SALOMEDS_StudyBuilder_i::SetGUID(SALOMEDS::SObject_ptr anObject, const char 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)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + _impl->SetGUID(aSO, string(theGUID)); } //============================================================================ @@ -358,9 +351,8 @@ bool SALOMEDS_StudyBuilder_i::IsGUID(SALOMEDS::SObject_ptr anObject, const char* { 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)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + return _impl->IsGUID(aSO, string(theGUID)); } @@ -525,9 +517,8 @@ void SALOMEDS_StudyBuilder_i::SetName(SALOMEDS::SObject_ptr theSO, const char* t 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)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + _impl->SetName(aSO, string(theValue)); } //============================================================================ @@ -542,9 +533,8 @@ void SALOMEDS_StudyBuilder_i::SetComment(SALOMEDS::SObject_ptr theSO, const char 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)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + _impl->SetComment(aSO, string(theValue)); } //============================================================================ @@ -559,7 +549,6 @@ void SALOMEDS_StudyBuilder_i::SetIOR(SALOMEDS::SObject_ptr theSO, const char* th 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)); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + _impl->SetIOR(aSO, string(theValue)); } diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx index 40d5fd18d..6d1db089d 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx @@ -34,17 +34,14 @@ #include "SALOMEDSImpl_StudyBuilder.hxx" -// Cascade header -#include - class SALOMEDS_StudyBuilder_i: public POA_SALOMEDS::StudyBuilder { private: CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_StudyBuilder) _impl; // OCAF Document + SALOMEDSImpl_StudyBuilder* _impl; public: - SALOMEDS_StudyBuilder_i(const Handle(SALOMEDSImpl_StudyBuilder), CORBA::ORB_ptr); + SALOMEDS_StudyBuilder_i(SALOMEDSImpl_StudyBuilder*, CORBA::ORB_ptr); ~SALOMEDS_StudyBuilder_i(); @@ -130,7 +127,7 @@ public: 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); - Handle(SALOMEDSImpl_StudyBuilder) GetImpl() { return _impl; } + SALOMEDSImpl_StudyBuilder* GetImpl() { return _impl; } }; #endif diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.cxx b/src/SALOMEDS/SALOMEDS_StudyManager.cxx index 335123165..1dae939cc 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager.cxx @@ -42,15 +42,11 @@ #include #endif -#include -#include -#include - #include "OpUtil.hxx" using namespace std; -SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb); +SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb); SALOMEDS_StudyManager::SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManager) { @@ -172,10 +168,10 @@ std::vector SALOMEDS_StudyManager::GetOpenStudies() if (_isLocal) { SALOMEDS::Locker lock; - 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()); + vector aSeq = _local_impl->GetOpenStudies(); + aLength = aSeq.size(); + for(i = 0; i < aLength; i++) + aVector.push_back(aSeq[i]->Name()); } else { SALOMEDS::ListOfOpenStudies_var aSeq = _corba_impl->GetOpenStudies(); @@ -192,8 +188,8 @@ _PTR(Study) SALOMEDS_StudyManager::GetStudyByName(const std::string& theStudyNam if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudy_impl = _local_impl->GetStudyByName((char*)theStudyName.c_str()); - if(aStudy_impl.IsNull()) return _PTR(Study)(aStudy); + SALOMEDSImpl_Study* aStudy_impl = _local_impl->GetStudyByName(theStudyName); + if(!aStudy_impl) return _PTR(Study)(aStudy); aStudy = new SALOMEDS_Study(aStudy_impl); } else { @@ -210,8 +206,8 @@ _PTR(Study) SALOMEDS_StudyManager::GetStudyByID(int theStudyID) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudy_impl = _local_impl->GetStudyByID(theStudyID); - if(aStudy_impl.IsNull()) return _PTR(Study)(aStudy); + SALOMEDSImpl_Study* aStudy_impl = _local_impl->GetStudyByID(theStudyID); + if(!aStudy_impl) return _PTR(Study)(aStudy); aStudy = new SALOMEDS_Study(aStudy_impl); } else { @@ -230,7 +226,7 @@ bool SALOMEDS_StudyManager::CanCopy(const _PTR(SObject)& theSO) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl(); + SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl()); SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb); ret = _local_impl->CanCopy(aSO_impl, aDriver); delete aDriver; @@ -249,7 +245,7 @@ bool SALOMEDS_StudyManager::Copy(const _PTR(SObject)& theSO) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl(); + SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl()); SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb); ret = _local_impl->Copy(aSO_impl, aDriver); delete aDriver; @@ -268,7 +264,7 @@ bool SALOMEDS_StudyManager::CanPaste(const _PTR(SObject)& theSO) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl(); + SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl()); SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb); ret = _local_impl->CanPaste(aSO_impl, aDriver); delete aDriver; @@ -288,9 +284,9 @@ _PTR(SObject) SALOMEDS_StudyManager::Paste(const _PTR(SObject)& theSO) if (_isLocal) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl(); + SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl()); SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb); - Handle(SALOMEDSImpl_SObject) aNewSO = _local_impl->Paste(aSO_impl, aDriver); + SALOMEDSImpl_SObject aNewSO = _local_impl->Paste(aSO_impl, aDriver); delete aDriver; if(aNewSO.IsNull()) return _PTR(SObject)(aResult); aResult = new SALOMEDS_SObject(aNewSO); @@ -312,15 +308,15 @@ void SALOMEDS_StudyManager::init_orb() _orb = init(0 , 0 ); } -SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb) +SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb) { SALOMEDS_Driver_i* driver = NULL; - Handle(SALOMEDSImpl_SComponent) aSCO = theObject->GetFatherComponent(); + 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()); + string IOREngine = aSCO.GetIOR(); + if(!IOREngine.empty()) { + CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str()); SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; driver = new SALOMEDS_Driver_i(Engine, orb); } diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.hxx b/src/SALOMEDS/SALOMEDS_StudyManager.hxx index c270ba1a4..96601d3dd 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager.hxx @@ -39,7 +39,7 @@ class Standard_EXPORT SALOMEDS_StudyManager: public SALOMEDSClient_StudyManager { private: bool _isLocal; - Handle(SALOMEDSImpl_StudyManager) _local_impl; + SALOMEDSImpl_StudyManager* _local_impl; SALOMEDS::StudyManager_var _corba_impl; CORBA::ORB_var _orb; diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index 4d612ccfd..f06c882ba 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -34,13 +34,10 @@ #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_AttributeIOR.hxx" -#include -#include -#include - #include "Utils_CorbaException.hxx" #include +#include #include using namespace std; @@ -60,7 +57,7 @@ using namespace std; 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 SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb); static std::map _mapOfPOA; @@ -91,6 +88,7 @@ SALOMEDS_StudyManager_i::~SALOMEDS_StudyManager_i() // Destroy directory to register open studies _name_service->Destroy_Directory("/Study"); delete _factory; + delete _impl; } //============================================================================ @@ -115,8 +113,8 @@ 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()) { + SALOMEDSImpl_Study* aStudyImpl = _impl->NewStudy(study_name); + if(!aStudyImpl) { MESSAGE("NewStudy : Error : " << _impl->GetErrorCode()); return SALOMEDS::Study::_nil(); } @@ -156,7 +154,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) Unexpect aCatch(SalomeException); MESSAGE("Begin of SALOMEDS_StudyManager_i::Open"); - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->Open(TCollection_AsciiString((char*)aUrl)); + SALOMEDSImpl_Study* aStudyImpl = _impl->Open(string(aUrl)); MESSAGE("Open : Creating the CORBA servant holding it... "); @@ -171,7 +169,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) // 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())); + else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().c_str())); return Study; } @@ -216,7 +214,7 @@ CORBA::Boolean SALOMEDS_StudyManager_i::Save(SALOMEDS::Study_ptr aStudy, CORBA:: return false; } - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); return _impl->Save(aStudyImpl, _factory, theMultiFile); } @@ -229,7 +227,7 @@ CORBA::Boolean SALOMEDS_StudyManager_i::SaveASCII(SALOMEDS::Study_ptr aStudy, CO return false; } - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); return _impl->SaveASCII(aStudyImpl, _factory, theMultiFile); } @@ -247,8 +245,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::SaveAs(const char* aUrl, SALOMEDS::Study return false; } - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - return _impl->SaveAs(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + return _impl->SaveAs(string(aUrl), aStudyImpl, _factory, theMultiFile); } CORBA::Boolean SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile) @@ -260,8 +258,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS:: return false; } - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - return _impl->SaveAsASCII(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + return _impl->SaveAsASCII(string(aUrl), aStudyImpl, _factory, theMultiFile); } //============================================================================ @@ -273,8 +271,8 @@ SALOMEDS::ListOfOpenStudies* SALOMEDS_StudyManager_i::GetOpenStudies() { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) anOpened = _impl->GetOpenStudies(); - int aLength = anOpened->Length(); + vector anOpened = _impl->GetOpenStudies(); + int aLength = anOpened.size(); SALOMEDS::ListOfOpenStudies_var _list_open_studies = new SALOMEDS::ListOfOpenStudies; _list_open_studies->length(aLength); @@ -285,11 +283,10 @@ SALOMEDS::ListOfOpenStudies* SALOMEDS_StudyManager_i::GetOpenStudies() } else { - for (unsigned int ind=1; ind <= aLength; ind++) + for (unsigned int ind=0; 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]) ; + _list_open_studies[ind] = CORBA::string_dup(anOpened[ind]->Name().c_str()); + SCRUTE(_list_open_studies[ind]) ; } } return _list_open_studies._retn(); @@ -304,12 +301,11 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByName(const char* aStudyNa { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudyImpl = - _impl->GetStudyByName(TCollection_AsciiString((char*)aStudyName)); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByName(string(aStudyName)); - if (aStudyImpl.IsNull()) + if (!aStudyImpl) { - MESSAGE(_impl->GetErrorCode().ToCString()); + MESSAGE(_impl->GetErrorCode().c_str()); return SALOMEDS::Study::_nil(); } @@ -328,11 +324,11 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudyID); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudyID); - if (aStudyImpl.IsNull()) + if (!aStudyImpl) { - MESSAGE(_impl->GetErrorCode().ToCString()); + MESSAGE(_impl->GetErrorCode().c_str()); return SALOMEDS::Study::_nil(); } @@ -354,8 +350,8 @@ 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()); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->CanCopy(anObject, aDriver); @@ -373,8 +369,8 @@ 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()); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->Copy(anObject, aDriver); @@ -392,8 +388,8 @@ 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()); + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->CanPaste(anObject, aDriver); @@ -414,9 +410,9 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theOb 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; + SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); + SALOMEDSImpl_SObject aNewSO; try { SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); @@ -432,15 +428,15 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theOb } -SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb) +SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb) { SALOMEDS_Driver_i* driver = NULL; - Handle(SALOMEDSImpl_SComponent) aSCO = theObject->GetFatherComponent(); + 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()); + string IOREngine = aSCO.GetIOR(); + if(!IOREngine.empty()) { + CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str()); SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; driver = new SALOMEDS_Driver_i(Engine, orb); } @@ -454,6 +450,20 @@ PortableServer::POA_ptr SALOMEDS_StudyManager_i::GetPOA(const SALOMEDS::Study_pt return PortableServer::POA::_nil(); } +CORBA::Long SALOMEDS_StudyManager_i::getPID() +{ +#ifdef WIN32 + return (CORBA::Long)_getpid(); +#else + return (CORBA::Long)getpid(); +#endif +} + +void SALOMEDS_StudyManager_i::ShutdownWithExit() +{ + exit( EXIT_SUCCESS ); +} + //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== @@ -465,27 +475,12 @@ CORBA::LongLong SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, C long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - SALOMEDSImpl_StudyManager* aManager = _impl.operator->(); - return ((CORBA::LongLong)aManager); + return ((CORBA::LongLong)(void*)_impl); } //=========================================================================== 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) { diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx index c66c12adc..41118c5db 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx @@ -27,6 +27,10 @@ // std C++ headers #include +#ifndef WNT +#include +#endif + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) @@ -36,16 +40,11 @@ #include -//Standard not implemented -#include #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); @@ -57,7 +56,7 @@ private: CORBA::ORB_ptr _orb; PortableServer::POA_var _poa; - Handle(SALOMEDSImpl_StudyManager) _impl; + SALOMEDSImpl_StudyManager* _impl; SALOME_NamingService* _name_service; SALOMEDS_DriverFactory_i* _factory; @@ -141,6 +140,8 @@ public: virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); }; void ping(){}; + CORBA::Long getPID(); + void ShutdownWithExit(); virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl deleted file mode 100644 index 84dbf1b27..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cdl +++ /dev/null @@ -1,107 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx deleted file mode 100644 index 44724c5f3..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.cxx +++ /dev/null @@ -1,217 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_StudyPropertiesAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include -using namespace std; - -const Standard_GUID& SALOMEDS_StudyPropertiesAttribute::GetID() -{ - static Standard_GUID SALOMEDS_StudyPropertiesAttributeID ("128371A2-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_StudyPropertiesAttributeID; -} - -Handle(SALOMEDS_StudyPropertiesAttribute) SALOMEDS_StudyPropertiesAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_StudyPropertiesAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_StudyPropertiesAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_StudyPropertiesAttribute::SALOMEDS_StudyPropertiesAttribute() -{ - myLocked = Standard_False; - myLockChanged = Standard_False; - Init(); -} - -void SALOMEDS_StudyPropertiesAttribute::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 SALOMEDS_StudyPropertiesAttribute::SetUserName(const TCollection_ExtendedString& theName) -{ - Backup(); - myUserName->Append(theName); -} - -void SALOMEDS_StudyPropertiesAttribute::SetFirstName(const TCollection_ExtendedString& theName) -{ - Backup(); - if (myUserName->Length() == 0) myUserName->Append(theName); - else myUserName->SetValue(1, theName); -} - -TCollection_ExtendedString SALOMEDS_StudyPropertiesAttribute::GetCreatorName() const -{ - if (myUserName->Length() == 0) return TCollection_ExtendedString(""); - return myUserName->Value(1); -} - -Handle(TColStd_HSequenceOfExtendedString) SALOMEDS_StudyPropertiesAttribute::GetUserNames() const -{ - return myUserName; -} - -void SALOMEDS_StudyPropertiesAttribute::SetModificationDate(const Standard_Integer theMinute, - const Standard_Integer theHour, - const Standard_Integer theDay, - const Standard_Integer theMonth, - const Standard_Integer theYear) -{ - Backup(); - if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 || theDay<0 || theDay>31 || theMonth<0 || theMonth>12) - return; - myMinute->Append(theMinute); - myHour->Append(theHour); - myDay->Append(theDay); - myMonth->Append(theMonth); - myYear->Append(theYear); -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::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 SALOMEDS_StudyPropertiesAttribute::GetModificationDates(Handle(TColStd_HSequenceOfInteger)& theMinutes, - Handle(TColStd_HSequenceOfInteger)& theHours, - Handle(TColStd_HSequenceOfInteger)& theDays, - Handle(TColStd_HSequenceOfInteger)& theMonths, - Handle(TColStd_HSequenceOfInteger)& theYears) const -{ - theMinutes = myMinute; - theHours = myHour; - theDays = myDay; - theMonths = myMonth; - theYears = myYear; -} - -void SALOMEDS_StudyPropertiesAttribute::SetCreationMode(const Standard_Integer theMode) -{ - Backup(); - myMode = theMode; -} - -Standard_Integer SALOMEDS_StudyPropertiesAttribute::GetCreationMode() const -{ - return myMode; -} - -void SALOMEDS_StudyPropertiesAttribute::SetModified(const Standard_Integer theModified) -{ - myModified = theModified; -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsModified() const -{ - return (myModified != 0); -} - -Standard_Integer SALOMEDS_StudyPropertiesAttribute::GetModified() const -{ - return myModified; -} - -void SALOMEDS_StudyPropertiesAttribute::SetLocked(const Standard_Boolean theLocked) -{ -// Backup(); - if (myLocked != theLocked) { - myLockChanged = Standard_True; - myLocked = theLocked; - } -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsLocked() const -{ - return myLocked; -} - -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsLockChanged(const Standard_Boolean theErase) { - if (!myLockChanged) return Standard_False; - if (theErase) myLockChanged = Standard_False; - return Standard_True; -} - -const Standard_GUID& SALOMEDS_StudyPropertiesAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_StudyPropertiesAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(with); - Init(); - Standard_Integer i; - Handle(TColStd_HSequenceOfExtendedString) aNames = aProp->GetUserNames(); - for(i = aNames->Length(); i > 0; i--) { - myUserName->Prepend(aNames->Value(i)); - } - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; - aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears); - for(i = aMinutes->Length(); i > 0; 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) SALOMEDS_StudyPropertiesAttribute::NewEmpty() const -{ - return new SALOMEDS_StudyPropertiesAttribute(); -} - -void SALOMEDS_StudyPropertiesAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(into); - aProp->Init(); - - Standard_Integer i; - for(i = 1; i <= myUserName->Length(); i++) { - aProp->SetUserName(myUserName->Value(i)); - } - for(i = 1; i <= myMinute->Length(); i++) { - aProp->SetModificationDate(myMinute->Value(i), myHour->Value(i), myDay->Value(i), myMonth->Value(i), myYear->Value(i)); - } - - aProp->SetCreationMode(myMode); -// aProp->SetModified(myModified); -// aProp->SetLocked(myLocked); -} - diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx deleted file mode 100644 index 276786515..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.hxx +++ /dev/null @@ -1,148 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_StudyPropertiesAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_StudyPropertiesAttribute_HeaderFile -#define _SALOMEDS_StudyPropertiesAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_StudyPropertiesAttribute_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfExtendedString; -class TColStd_HSequenceOfInteger; -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_StudyPropertiesAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_StudyPropertiesAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_StudyPropertiesAttribute(); -Standard_EXPORT void Init() ; -Standard_EXPORT void SetUserName(const TCollection_ExtendedString& theName) ; -Standard_EXPORT void SetFirstName(const TCollection_ExtendedString& theName) ; -Standard_EXPORT TCollection_ExtendedString GetCreatorName() const; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetUserNames() const; -Standard_EXPORT void SetModificationDate(const Standard_Integer theMinute,const Standard_Integer theHour,const Standard_Integer theDay,const Standard_Integer theMonth,const Standard_Integer theYear) ; -Standard_EXPORT Standard_Boolean GetCreationDate(Standard_Integer& theMinute,Standard_Integer& theHour,Standard_Integer& theDay,Standard_Integer& theMonth,Standard_Integer& theYear) const; -Standard_EXPORT void GetModificationDates(Handle(TColStd_HSequenceOfInteger)& theMinutes,Handle(TColStd_HSequenceOfInteger)& theHours,Handle(TColStd_HSequenceOfInteger)& theDays,Handle(TColStd_HSequenceOfInteger)& theMonths,Handle(TColStd_HSequenceOfInteger)& theYears) const; -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 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 ~SALOMEDS_StudyPropertiesAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_StudyPropertiesAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields 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; - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx deleted file mode 100644 index 6fb0417b3..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.ixx +++ /dev/null @@ -1,68 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_StudyPropertiesAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_StudyPropertiesAttribute::~SALOMEDS_StudyPropertiesAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_StudyPropertiesAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_StudyPropertiesAttribute", - sizeof(SALOMEDS_StudyPropertiesAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_StudyPropertiesAttribute) Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_StudyPropertiesAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute))) { - _anOtherObject = Handle(SALOMEDS_StudyPropertiesAttribute)((Handle(SALOMEDS_StudyPropertiesAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_StudyPropertiesAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute) ; -} -Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_StudyPropertiesAttribute::~Handle_SALOMEDS_StudyPropertiesAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx b/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx deleted file mode 100644 index 419ea7b87..000000000 --- a/src/SALOMEDS/SALOMEDS_StudyPropertiesAttribute.jxx +++ /dev/null @@ -1,35 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_StudyPropertiesAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_StudyPropertiesAttribute_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 51c1be559..137c34bd5 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -40,14 +40,8 @@ #include "SALOMEDSImpl_ChildIterator.hxx" #include "SALOMEDSImpl_IParameters.hxx" -#include -#include -#include -#include -#include - -#include -#include +#include "DF_Label.hxx" +#include "DF_Attribute.hxx" #ifdef WIN32 #include @@ -65,7 +59,7 @@ using namespace std; * Purpose : SALOMEDS_Study_i constructor */ //============================================================================ -SALOMEDS_Study_i::SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study) theImpl, +SALOMEDS_Study_i::SALOMEDS_Study_i(SALOMEDSImpl_Study* theImpl, CORBA::ORB_ptr orb) { _orb = CORBA::ORB::_duplicate(orb); @@ -91,7 +85,7 @@ SALOMEDS_Study_i::~SALOMEDS_Study_i() char* SALOMEDS_Study_i::GetPersistentReference() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->GetPersistentReference().ToCString()); + return CORBA::string_dup(_impl->GetPersistentReference().c_str()); } //============================================================================ /*! Function : GetTransientReference @@ -101,7 +95,7 @@ char* SALOMEDS_Study_i::GetPersistentReference() char* SALOMEDS_Study_i::GetTransientReference() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->GetTransientReference().ToCString()); + return CORBA::string_dup(_impl->GetTransientReference().c_str()); } //============================================================================ @@ -124,7 +118,7 @@ SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponent (const char* aComponent { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponent(TCollection_AsciiString((char*)aComponentName)); + SALOMEDSImpl_SComponent aCompImpl = _impl->FindComponent(string(aComponentName)); if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil(); SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aCompImpl, _orb); @@ -140,7 +134,7 @@ SALOMEDS::SComponent_ptr SALOMEDS_Study_i::FindComponentID(const char* aComponen { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponentID(TCollection_AsciiString((char*)aComponentID)); + SALOMEDSImpl_SComponent aCompImpl = _impl->FindComponentID(string((char*)aComponentID)); if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil(); SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aCompImpl, _orb); @@ -156,11 +150,11 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObject(const char* anObjectName) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObject(TCollection_AsciiString((char*)anObjectName)); + SALOMEDSImpl_SObject aSO = _impl->FindObject(string((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); + if(aSO.IsComponent()) { + SALOMEDSImpl_SComponent aSCO = aSO; SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aSCO, _orb); return sco._retn(); } @@ -179,7 +173,7 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectID(const char* anObjectID) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectID(TCollection_AsciiString((char*)anObjectID)); + SALOMEDSImpl_SObject aSO = _impl->FindObjectID(string((char*)anObjectID)); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); @@ -196,7 +190,7 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::CreateObjectID(const char* anObjectID) if(!anObjectID || strlen(anObjectID) == 0) return SALOMEDS::SObject::_nil(); - Handle(SALOMEDSImpl_SObject) aSO = _impl->CreateObjectID((char*)anObjectID); + SALOMEDSImpl_SObject aSO = _impl->CreateObjectID((char*)anObjectID); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); @@ -214,15 +208,14 @@ SALOMEDS::Study::ListOfSObject* SALOMEDS_Study_i::FindObjectByName( const char* { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfTransient) aSeq = _impl->FindObjectByName(TCollection_AsciiString((char*)anObjectName), - TCollection_AsciiString((char*)aComponentName)); - int aLength = aSeq->Length(); + vector aSeq = _impl->FindObjectByName(string((char*)anObjectName), + string((char*)aComponentName)); + int aLength = aSeq.size(); 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 ; + for(int i = 0; iFindObjectIOR(TCollection_AsciiString((char*)anObjectIOR)); + SALOMEDSImpl_SObject aSO = _impl->FindObjectIOR(string((char*)anObjectIOR)); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); @@ -252,7 +245,7 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::FindObjectByPath(const char* thePath) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectByPath(TCollection_AsciiString((char*)thePath)); + SALOMEDSImpl_SObject aSO = _impl->FindObjectByPath(string((char*)thePath)); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); @@ -268,9 +261,9 @@ 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; + string aPath(""); + if(CORBA::is_nil(theObject)) return CORBA::string_dup(aPath.c_str()); + SALOMEDSImpl_SObject aSO; SALOMEDS::SObject_var aSObj = SALOMEDS::SObject::_narrow(theObject); if(!CORBA::is_nil(aSObj)) { @@ -280,10 +273,10 @@ char* SALOMEDS_Study_i::GetObjectPath(CORBA::Object_ptr theObject) aSO = _impl->FindObjectIOR(_orb->object_to_string(theObject)); } - if(aSO.IsNull()) return CORBA::string_dup(aPath.ToCString()); + if(aSO.IsNull()) return CORBA::string_dup(aPath.c_str()); aPath = _impl->GetObjectPath(aSO); - return CORBA::string_dup(aPath.ToCString()); + return CORBA::string_dup(aPath.c_str()); } @@ -296,7 +289,7 @@ void SALOMEDS_Study_i::SetContext(const char* thePath) { SALOMEDS::Locker lock; - _impl->SetContext(TCollection_AsciiString((char*)thePath)); + _impl->SetContext(string((char*)thePath)); if(_impl->IsError() && _impl->GetErrorCode() == "InvalidContext") throw SALOMEDS::Study::StudyInvalidContext(); } @@ -309,9 +302,9 @@ void SALOMEDS_Study_i::SetContext(const char* thePath) char* SALOMEDS_Study_i::GetContext() { SALOMEDS::Locker lock; - + if(!_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - return CORBA::string_dup(_impl->GetContext().ToCString()); + return CORBA::string_dup(_impl->GetContext().c_str()); } //============================================================================ @@ -328,15 +321,14 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetObjectNames(const char* theContext if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = - _impl->GetObjectNames(TCollection_AsciiString((char*)theContext)); + vector aSeq = _impl->GetObjectNames(string((char*)theContext)); if (_impl->GetErrorCode() == "InvalidContext") throw SALOMEDS::Study::StudyInvalidContext(); - int aLength = aSeq->Length(); + int aLength = aSeq.size(); aResult->length(aLength); - for (int anIndex = 1; anIndex <= aLength; anIndex++) { - aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); + for (int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aResult._retn(); @@ -356,15 +348,14 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetDirectoryNames(const char* theCont if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = - _impl->GetDirectoryNames(TCollection_AsciiString((char*)theContext)); + vector aSeq = _impl->GetDirectoryNames(string((char*)theContext)); if (_impl->GetErrorCode() == "InvalidContext") throw SALOMEDS::Study::StudyInvalidContext(); - int aLength = aSeq->Length(); + int aLength = aSeq.size(); aResult->length(aLength); - for (int anIndex = 1; anIndex <= aLength; anIndex++) { - aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); + for (int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aResult._retn(); @@ -384,15 +375,14 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext) if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = - _impl->GetFileNames(TCollection_AsciiString((char*)theContext)); + vector aSeq = _impl->GetFileNames(string((char*)theContext)); if (_impl->GetErrorCode() == "InvalidContext") throw SALOMEDS::Study::StudyInvalidContext(); - int aLength = aSeq->Length(); + int aLength = aSeq.size(); aResult->length(aLength); - for (int anIndex = 1; anIndex <= aLength; anIndex++) { - aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); + for (int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aResult._retn(); @@ -410,13 +400,12 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theCont SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - Handle(TColStd_HSequenceOfAsciiString) aSeq = - _impl->GetComponentNames(TCollection_AsciiString((char*)theContext)); + vector aSeq = _impl->GetComponentNames(string((char*)theContext)); - int aLength = aSeq->Length(); + int aLength = aSeq.size(); aResult->length(aLength); - for(int anIndex = 1; anIndex <= aLength; anIndex++) { - aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); + for(int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aResult._retn(); @@ -431,8 +420,8 @@ SALOMEDS::ChildIterator_ptr SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->GetSObject(theSO->GetID()); - Handle(SALOMEDSImpl_ChildIterator) anItr = new SALOMEDSImpl_ChildIterator(aSO); + SALOMEDSImpl_SObject aSO = _impl->GetSObject(theSO->GetID()); + SALOMEDSImpl_ChildIterator anItr(aSO); //Create iterator SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(anItr, _orb); @@ -475,7 +464,7 @@ SALOMEDS::StudyBuilder_ptr SALOMEDS_Study_i::NewBuilder() char* SALOMEDS_Study_i::Name() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->Name().ToCString()); + return CORBA::string_dup(_impl->Name().c_str()); } //============================================================================ @@ -486,7 +475,7 @@ char* SALOMEDS_Study_i::Name() void SALOMEDS_Study_i::Name(const char* name) { SALOMEDS::Locker lock; - _impl->Name(TCollection_AsciiString((char*)name)); + _impl->Name(string((char*)name)); } //============================================================================ @@ -524,13 +513,13 @@ CORBA::Boolean SALOMEDS_Study_i::IsModified() //============================================================================ /*! Function : Modified - * Purpose : Set a Modified flag of a Study to True + * Purpose : Sets a Modified flag of a Study to True */ //============================================================================ void SALOMEDS_Study_i::Modified() { SALOMEDS::Locker lock; - _impl->Modify(); + return _impl->Modify(); } @@ -542,7 +531,7 @@ void SALOMEDS_Study_i::Modified() char* SALOMEDS_Study_i::URL() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->URL().ToCString()); + return CORBA::string_dup(_impl->URL().c_str()); } //============================================================================ @@ -553,7 +542,7 @@ char* SALOMEDS_Study_i::URL() void SALOMEDS_Study_i::URL(const char* url) { SALOMEDS::Locker lock; - _impl->URL(TCollection_AsciiString((char*)url)); + _impl->URL(string((char*)url)); } @@ -572,16 +561,16 @@ void SALOMEDS_Study_i::StudyId(CORBA::Short 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)); + _impl->UpdateIORLabelMap(string((char*)anIOR), string((char*)anEntry)); } -SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb) +SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const DF_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()); + SALOMEDSImpl_AttributeIOR* Att = NULL; + if ((Att=(SALOMEDSImpl_AttributeIOR*)theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))){ + char* IOR = CORBA::string_dup(Att->Value().c_str()); CORBA::Object_var obj = orb->string_to_object(IOR); SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ; ASSERT(!CORBA::is_nil(aStudy)); @@ -592,7 +581,7 @@ SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA:: return SALOMEDS::Study::_nil(); } -void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute) +void SALOMEDS_Study_i::IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute) { SALOMEDS::Locker lock; SALOMEDSImpl_Study::IORUpdated(theAttribute); @@ -616,7 +605,7 @@ SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr = _impl->GetProperties(); + SALOMEDSImpl_AttributeStudyProperties* anAttr = _impl->GetProperties(); SALOMEDS_AttributeStudyProperties_i* SP = new SALOMEDS_AttributeStudyProperties_i(anAttr, _orb); return SP->AttributeStudyProperties::_this(); } @@ -624,20 +613,20 @@ SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties() char* SALOMEDS_Study_i::GetLastModificationDate() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->GetLastModificationDate().ToCString()); + return CORBA::string_dup(_impl->GetLastModificationDate().c_str()); } SALOMEDS::ListOfDates* SALOMEDS_Study_i::GetModificationsDate() { SALOMEDS::Locker lock; - Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetModificationsDate(); - int aLength = aSeq->Length(); + vector aSeq = _impl->GetModificationsDate(); + int aLength = aSeq.size(); 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()); + for(int anIndex = 0; anIndex < aLength; anIndex++) { + aDates[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aDates._retn(); } @@ -665,14 +654,12 @@ SALOMEDS::UseCaseBuilder_ptr SALOMEDS_Study_i::GetUseCaseBuilder() 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; @@ -691,6 +678,7 @@ void SALOMEDS_Study_i::Close() } } } + _impl->Close(); } @@ -702,23 +690,13 @@ void SALOMEDS_Study_i::Close() 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); - } + //Not implemented } 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); - } + //Not implemented } //============================================================================ @@ -727,37 +705,25 @@ void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR) */ //============================================================================ #ifndef WNT -void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit) +void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long /*theUndoLimit*/) #else -void SALOMEDS_Study_i::RemovePostponed(CORBA::Long theUndoLimit) +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()); + vector anIORs = _impl->GetIORs(); + int i, aSize = (int)anIORs.size(); + + for(i = 0; i < aSize; i++) { + try { + CORBA::Object_var obj = _orb->string_to_object(anIORs[i].c_str()); 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 (...) {} - } + } catch (...) {} } + + //Not implemented } //============================================================================ @@ -772,8 +738,7 @@ void SALOMEDS_Study_i::UndoPostponed(CORBA::Long theWay) #endif { SALOMEDS::Locker lock; - - _impl->UndoPostponed(theWay); + //Not implemented } @@ -788,7 +753,7 @@ CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, { SALOMEDS::Locker lock; - TCollection_AsciiString aPath((char*)thePath), aBaseName((char*)theBaseName); + string 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; @@ -804,7 +769,7 @@ SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetCommonParameters(const cha { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) anAttr = _impl->GetCommonParameters(theID, theSavePoint); + SALOMEDSImpl_AttributeParameter* anAttr = _impl->GetCommonParameters(theID, theSavePoint); SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb); return SP->AttributeParameter::_this(); } @@ -820,7 +785,7 @@ SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetModuleParameters(const cha { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeParameter) anAttr = _impl->GetModuleParameters(theID, theModuleName, theSavePoint); + SALOMEDSImpl_AttributeParameter* anAttr = _impl->GetModuleParameters(theID, theModuleName, theSavePoint); SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb); return SP->AttributeParameter::_this(); } @@ -869,12 +834,12 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetLockerID() SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetLockerID(); + vector aSeq = _impl->GetLockerID(); - int aLength = aSeq->Length(); + int aLength = aSeq.size(); aResult->length(aLength); - for(int anIndex = 1; anIndex <= aLength; anIndex++) { - aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString()); + for(int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); } return aResult._retn(); } @@ -900,8 +865,8 @@ char* SALOMEDS_Study_i::GetDefaultScript(const char* theModuleName, const char* void SALOMEDS_Study_i::EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _impl->EnableUseCaseAutoFilling(isEnabled); - Handle(SALOMEDSImpl_StudyBuilder) builder = _builder->GetImpl(); - if(!builder.IsNull()) { + SALOMEDSImpl_StudyBuilder* builder = _builder->GetImpl(); + if(builder) { if(isEnabled) { builder->SetOnAddSObject(_impl->GetCallback()); builder->SetOnRemoveSObject(_impl->GetCallback()); @@ -924,6 +889,5 @@ CORBA::LongLong SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::L long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - SALOMEDSImpl_Study* local_impl = _impl.operator->(); - return ((CORBA::LongLong)local_impl); + return ((CORBA::LongLong)_impl); } diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index bcbae1dee..efb31e66e 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -47,13 +47,13 @@ class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study { private: CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_Study) _impl; + SALOMEDSImpl_Study* _impl; SALOMEDS_StudyBuilder_i* _builder; public: //! standard constructor - SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study), CORBA::ORB_ptr); + SALOMEDS_Study_i(SALOMEDSImpl_Study*, CORBA::ORB_ptr); //! standard destructor virtual ~SALOMEDS_Study_i(); @@ -223,9 +223,8 @@ public: */ virtual CORBA::Boolean IsModified(); - //! method to set a Modified flag of a Study to True - virtual void Modified(); - + //! method to set Modified flag of a Study to True + virtual void Modified(); //! method to get URL of the study (idem GetPersistentReference) /*! @@ -242,9 +241,9 @@ public: virtual CORBA::Short StudyId(); virtual void StudyId(CORBA::Short id); - static SALOMEDS::Study_ptr GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb); + static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb); - static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute); + static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute); virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel); @@ -299,7 +298,7 @@ public: virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished); - virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; } + virtual SALOMEDSImpl_Study* GetImpl() { return _impl; } virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; diff --git a/src/SALOMEDS/SALOMEDS_TMPFile_i.cxx b/src/SALOMEDS/SALOMEDS_TMPFile_i.cxx index b3d5c5028..a2c96cef1 100644 --- a/src/SALOMEDS/SALOMEDS_TMPFile_i.cxx +++ b/src/SALOMEDS/SALOMEDS_TMPFile_i.cxx @@ -25,15 +25,8 @@ #include "SALOMEDS_TMPFile_i.hxx" -#include -#include - #include - -IMPLEMENT_STANDARD_HANDLE( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile ) - SALOMEDS_TMPFile_i ::SALOMEDS_TMPFile_i(SALOMEDS::TMPFile* theStream): myStream(theStream) @@ -64,9 +57,6 @@ SALOMEDS_TMPFile_i //----------------------------------------------------------------------------- -IMPLEMENT_STANDARD_HANDLE( Engines_TMPFile_i, SALOMEDSImpl_TMPFile ) -IMPLEMENT_STANDARD_RTTIEXT( Engines_TMPFile_i, SALOMEDSImpl_TMPFile ) - Engines_TMPFile_i ::Engines_TMPFile_i(Engines::TMPFile* theStream): myStream(theStream) diff --git a/src/SALOMEDS/SALOMEDS_TMPFile_i.hxx b/src/SALOMEDS/SALOMEDS_TMPFile_i.hxx index 1885341b6..0b5c96e34 100644 --- a/src/SALOMEDS/SALOMEDS_TMPFile_i.hxx +++ b/src/SALOMEDS/SALOMEDS_TMPFile_i.hxx @@ -30,7 +30,6 @@ //----------------------------------------------------------------------------- -DEFINE_STANDARD_HANDLE( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile ); class SALOMEDS_TMPFile_i : public SALOMEDSImpl_TMPFile { @@ -41,15 +40,12 @@ public: virtual TOctet& Get(size_t); - DEFINE_STANDARD_RTTI( SALOMEDS_TMPFile_i ); - protected: SALOMEDS::TMPFile_var myStream; }; //----------------------------------------------------------------------------- -DEFINE_STANDARD_HANDLE( Engines_TMPFile_i, SALOMEDSImpl_TMPFile ); class Engines_TMPFile_i : public SALOMEDSImpl_TMPFile { @@ -60,8 +56,6 @@ public: virtual TOctet& Get(size_t); - DEFINE_STANDARD_RTTI( Engines_TMPFile_i ); - protected: Engines::TMPFile_var myStream; }; diff --git a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.cxx b/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.cxx deleted file mode 100644 index ec7dd3292..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.cxx +++ /dev/null @@ -1,399 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfIntegerAttribute.cxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include -#include -#include - -#include -using namespace std; - -const Standard_GUID& SALOMEDS_TableOfIntegerAttribute::GetID() -{ - static Standard_GUID SALOMEDS_TableOfIntegerAttributeID ("128371A0-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TableOfIntegerAttributeID; -} - -Handle(SALOMEDS_TableOfIntegerAttribute) SALOMEDS_TableOfIntegerAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_TableOfIntegerAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_TableOfIntegerAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_TableOfIntegerAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_TableOfIntegerAttribute::SALOMEDS_TableOfIntegerAttribute() { - myRows = new TColStd_HSequenceOfExtendedString(); - myCols = new TColStd_HSequenceOfExtendedString(); - myNbRows = 0; - myNbColumns = 0; -} - -void SALOMEDS_TableOfIntegerAttribute::SetNbColumns(const Standard_Integer theNbColumns) -{ - 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("")); - } -} - -void SALOMEDS_TableOfIntegerAttribute::SetTitle(const TCollection_ExtendedString& theTitle) { - Backup(); - myTitle = theTitle; -} - -TCollection_ExtendedString SALOMEDS_TableOfIntegerAttribute::GetTitle() const { - return myTitle; -} - -void SALOMEDS_TableOfIntegerAttribute::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfInteger)& theData) -{ - 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; -} - -Handle(TColStd_HSequenceOfInteger) SALOMEDS_TableOfIntegerAttribute::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 SALOMEDS_TableOfIntegerAttribute::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) { - Backup(); - myRows->SetValue(theRow,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfIntegerAttribute::GetRowTitle(const Standard_Integer theRow) const { - return myRows->Value(theRow); -} - - -void SALOMEDS_TableOfIntegerAttribute::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfInteger)& theData) -{ - 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("")); - } - } -} - - -Handle(TColStd_HSequenceOfInteger) SALOMEDS_TableOfIntegerAttribute::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 SALOMEDS_TableOfIntegerAttribute::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) { - Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfIntegerAttribute::GetColumnTitle(const Standard_Integer theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); -} - - -Standard_Integer SALOMEDS_TableOfIntegerAttribute::GetNbRows() const -{ - return myNbRows; -} - -Standard_Integer SALOMEDS_TableOfIntegerAttribute::GetNbColumns() const -{ - return myNbColumns; -} - -void SALOMEDS_TableOfIntegerAttribute::PutValue(const Standard_Integer theValue, - const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - 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; - } -} - -Standard_Boolean SALOMEDS_TableOfIntegerAttribute::HasValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - return myTable.IsBound(anIndex); -} - -Standard_Integer SALOMEDS_TableOfIntegerAttribute::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - 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& SALOMEDS_TableOfIntegerAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_TableOfIntegerAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::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) SALOMEDS_TableOfIntegerAttribute::NewEmpty() const -{ - return new SALOMEDS_TableOfIntegerAttribute(); -} - -void SALOMEDS_TableOfIntegerAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::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 SALOMEDS_TableOfIntegerAttribute::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 SALOMEDS_TableOfIntegerAttribute::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 SALOMEDS_TableOfIntegerAttribute::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 SALOMEDS_TableOfIntegerAttribute::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; -} diff --git a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.hxx b/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.hxx deleted file mode 100644 index 6d888b3d9..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.hxx +++ /dev/null @@ -1,163 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfIntegerAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_TableOfIntegerAttribute_HeaderFile -#define _SALOMEDS_TableOfIntegerAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TableOfIntegerAttribute_HeaderFile -#include -#endif - -#ifndef _TColStd_SequenceOfTransient_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif - -#ifndef _TColStd_DataMapOfIntegerInteger_HeaderFile -#include -#endif - -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfExtendedString; -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TColStd_HSequenceOfInteger; -class TDF_Attribute; -class TDF_RelocationTable; - -#include - -class SALOMEDS_TableOfIntegerAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_TableOfIntegerAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_TableOfIntegerAttribute(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfInteger)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfInteger)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const Standard_Integer theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Integer GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -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 Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); - -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); - -Standard_EXPORT ~SALOMEDS_TableOfIntegerAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TableOfIntegerAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TColStd_DataMapOfIntegerInteger myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.ixx b/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.ixx deleted file mode 100644 index 79a6c9823..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.ixx +++ /dev/null @@ -1,68 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfIntegerAttribute.ixx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TableOfIntegerAttribute::~SALOMEDS_TableOfIntegerAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TableOfIntegerAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TableOfIntegerAttribute", - sizeof(SALOMEDS_TableOfIntegerAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TableOfIntegerAttribute) Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TableOfIntegerAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute))) { - _anOtherObject = Handle(SALOMEDS_TableOfIntegerAttribute)((Handle(SALOMEDS_TableOfIntegerAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TableOfIntegerAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute) ; -} -Standard_Boolean SALOMEDS_TableOfIntegerAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_TableOfIntegerAttribute::~Handle_SALOMEDS_TableOfIntegerAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.jxx b/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.jxx deleted file mode 100644 index 9636d150f..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfIntegerAttribute.jxx +++ /dev/null @@ -1,35 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfIntegerAttribute.jxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_HSequenceOfInteger_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TableOfIntegerAttribute_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.cxx b/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.cxx deleted file mode 100644 index d0096d9c8..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.cxx +++ /dev/null @@ -1,405 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfRealAttribute.cxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include -#include -#include - -#include -#include -using namespace std; - -const Standard_GUID& SALOMEDS_TableOfRealAttribute::GetID() -{ - static Standard_GUID SALOMEDS_TableOfRealAttributeID ("128371A1-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TableOfRealAttributeID; -} - -Handle(SALOMEDS_TableOfRealAttribute) SALOMEDS_TableOfRealAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_TableOfRealAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_TableOfRealAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_TableOfRealAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_TableOfRealAttribute::SALOMEDS_TableOfRealAttribute() { - myRows = new TColStd_HSequenceOfExtendedString(); - myCols = new TColStd_HSequenceOfExtendedString(); - myNbRows = 0; - myNbColumns = 0; -} - -void SALOMEDS_TableOfRealAttribute::SetNbColumns(const Standard_Integer theNbColumns) -{ - 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("")); - } -} - -void SALOMEDS_TableOfRealAttribute::SetTitle(const TCollection_ExtendedString& theTitle) { - Backup(); - myTitle = theTitle; -} - -TCollection_ExtendedString SALOMEDS_TableOfRealAttribute::GetTitle() const { - return myTitle; -} - -void SALOMEDS_TableOfRealAttribute::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfReal)& theData) -{ - 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; -} - -Handle(TColStd_HSequenceOfReal) SALOMEDS_TableOfRealAttribute::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 SALOMEDS_TableOfRealAttribute::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) { - Backup(); - myRows->SetValue(theRow,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfRealAttribute::GetRowTitle(const Standard_Integer theRow) const { - return myRows->Value(theRow); -} - - -void SALOMEDS_TableOfRealAttribute::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfReal)& theData) -{ - 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("")); - } - } -} - - -Handle(TColStd_HSequenceOfReal) SALOMEDS_TableOfRealAttribute::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 SALOMEDS_TableOfRealAttribute::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) { - Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfRealAttribute::GetColumnTitle(const Standard_Integer theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); -} - - -Standard_Integer SALOMEDS_TableOfRealAttribute::GetNbRows() const -{ - return myNbRows; -} - -Standard_Integer SALOMEDS_TableOfRealAttribute::GetNbColumns() const -{ - return myNbColumns; -} - -void SALOMEDS_TableOfRealAttribute::PutValue(const Standard_Real theValue, - const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - 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; - } -} - -Standard_Boolean SALOMEDS_TableOfRealAttribute::HasValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - return myTable.IsBound(anIndex); -} - -Standard_Real SALOMEDS_TableOfRealAttribute::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - 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& SALOMEDS_TableOfRealAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_TableOfRealAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::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) SALOMEDS_TableOfRealAttribute::NewEmpty() const -{ - return new SALOMEDS_TableOfRealAttribute(); -} - -void SALOMEDS_TableOfRealAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::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 SALOMEDS_TableOfRealAttribute::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 SALOMEDS_TableOfRealAttribute::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 SALOMEDS_TableOfRealAttribute::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 SALOMEDS_TableOfRealAttribute::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; -} diff --git a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.hxx b/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.hxx deleted file mode 100644 index cac9dd3b0..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.hxx +++ /dev/null @@ -1,171 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfRealAttribute.hxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_TableOfRealAttribute_HeaderFile -#define _SALOMEDS_TableOfRealAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TableOfRealAttribute_HeaderFile -#include -#endif - -#ifndef _TColStd_SequenceOfTransient_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif - -#ifndef _TColStd_DataMapOfIntegerReal_HeaderFile -#include -#endif - -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif - -#ifndef TColStd_HSequenceOfInteger_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfReal_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfExtendedString; -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TColStd_HSequenceOfReal; -class TDF_Attribute; -class TDF_RelocationTable; - -#include - -class SALOMEDS_TableOfRealAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_TableOfRealAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_TableOfRealAttribute(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfReal)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfReal GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfReal)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfReal GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const Standard_Real theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Real GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -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 Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); - -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); - -Standard_EXPORT ~SALOMEDS_TableOfRealAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TableOfRealAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -TColStd_DataMapOfIntegerReal myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.ixx b/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.ixx deleted file mode 100644 index c8bfe73d0..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.ixx +++ /dev/null @@ -1,68 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfRealAttribute.ixx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TableOfRealAttribute::~SALOMEDS_TableOfRealAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TableOfRealAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TableOfRealAttribute", - sizeof(SALOMEDS_TableOfRealAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TableOfRealAttribute) Handle(SALOMEDS_TableOfRealAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TableOfRealAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TableOfRealAttribute))) { - _anOtherObject = Handle(SALOMEDS_TableOfRealAttribute)((Handle(SALOMEDS_TableOfRealAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TableOfRealAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TableOfRealAttribute) ; -} -Standard_Boolean SALOMEDS_TableOfRealAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TableOfRealAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_TableOfRealAttribute::~Handle_SALOMEDS_TableOfRealAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.jxx b/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.jxx deleted file mode 100644 index a2343b1ec..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfRealAttribute.jxx +++ /dev/null @@ -1,35 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfRealAttribute.jxx -// Author : Michael Ponikarov -// Module : SALOME -// $Header$ - -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_HSequenceOfReal_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TableOfRealAttribute_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.cxx b/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.cxx deleted file mode 100644 index fa4b21785..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.cxx +++ /dev/null @@ -1,423 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfStringAttribute.cxx -// Author : Sergey Ruin -// Module : SALOME - -#include -#include -#include - -#include -#include -using namespace std; - -const Standard_GUID& SALOMEDS_TableOfStringAttribute::GetID() -{ - static Standard_GUID SALOMEDS_TableOfStringAttributeID ("128371A4-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TableOfStringAttributeID; -} - -Handle(SALOMEDS_TableOfStringAttribute) SALOMEDS_TableOfStringAttribute::Set(const TDF_Label& label) -{ - Handle(SALOMEDS_TableOfStringAttribute) anAttr; - if (!label.FindAttribute(SALOMEDS_TableOfStringAttribute::GetID(),anAttr)) { - anAttr = new SALOMEDS_TableOfStringAttribute(); - label.AddAttribute(anAttr); - } - return anAttr; -} - -SALOMEDS_TableOfStringAttribute::SALOMEDS_TableOfStringAttribute() { - myRows = new TColStd_HSequenceOfExtendedString(); - myCols = new TColStd_HSequenceOfExtendedString(); - myNbRows = 0; - myNbColumns = 0; -} - -void SALOMEDS_TableOfStringAttribute::SetNbColumns(const Standard_Integer theNbColumns) -{ - Backup(); - - SALOMEDS_DataMapOfIntegerString aMap; - aMap = myTable; - myTable.Clear(); - - SALOMEDS_DataMapIteratorOfDataMapOfIntegerString 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("")); - } -} - -void SALOMEDS_TableOfStringAttribute::SetTitle(const TCollection_ExtendedString& theTitle) { - Backup(); - myTitle = theTitle; -} - -TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetTitle() const { - return myTitle; -} - -void SALOMEDS_TableOfStringAttribute::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfExtendedString)& theData) -{ - 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; -} - -Handle(TColStd_HSequenceOfExtendedString) SALOMEDS_TableOfStringAttribute::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 SALOMEDS_TableOfStringAttribute::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) { - Backup(); - myRows->SetValue(theRow,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetRowTitle(const Standard_Integer theRow) const { - return myRows->Value(theRow); -} - - -void SALOMEDS_TableOfStringAttribute::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfExtendedString)& theData) -{ - 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("")); - } - } -} - - -Handle(TColStd_HSequenceOfExtendedString) SALOMEDS_TableOfStringAttribute::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 SALOMEDS_TableOfStringAttribute::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) { - Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); -} - -TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetColumnTitle(const Standard_Integer theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); -} - - -Standard_Integer SALOMEDS_TableOfStringAttribute::GetNbRows() const -{ - return myNbRows; -} - -Standard_Integer SALOMEDS_TableOfStringAttribute::GetNbColumns() const -{ - return myNbColumns; -} - -void SALOMEDS_TableOfStringAttribute::PutValue(const TCollection_ExtendedString& theValue, - const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - 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; - } -} - -Standard_Boolean SALOMEDS_TableOfStringAttribute::HasValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - return myTable.IsBound(anIndex); -} - -TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) -{ - 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& SALOMEDS_TableOfStringAttribute::ID() const -{ - return GetID(); -} - -void SALOMEDS_TableOfStringAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::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) SALOMEDS_TableOfStringAttribute::NewEmpty() const -{ - return new SALOMEDS_TableOfStringAttribute(); -} - -void SALOMEDS_TableOfStringAttribute::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const -{ - Standard_Integer anIndex; - Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::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 SALOMEDS_TableOfStringAttribute::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 SALOMEDS_TableOfStringAttribute::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 SALOMEDS_TableOfStringAttribute::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"; - SALOMEDS_DataMapIteratorOfDataMapOfIntegerString 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<> 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; -} diff --git a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.hxx b/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.hxx deleted file mode 100644 index 230d486f4..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.hxx +++ /dev/null @@ -1,170 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfStringAttribute.hxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _SALOMEDS_TableOfStringAttribute_HeaderFile -#define _SALOMEDS_TableOfStringAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TableOfStringAttribute_HeaderFile -#include -#endif - -#ifndef _TColStd_SequenceOfTransient_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif - -#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile -#include -#endif - -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile -#include -#endif - -#ifndef TColStd_HSequenceOfInteger_HeaderFile -#include -#endif - -#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class TColStd_HSequenceOfExtendedString; -class Standard_GUID; -class TDF_Label; -class TCollection_ExtendedString; -class TColStd_HSequenceOfExtendedString; -class TDF_Attribute; -class TDF_RelocationTable; - -#include - -class SALOMEDS_TableOfStringAttribute : public TDF_Attribute { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_TableOfStringAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_TableOfStringAttribute(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfExtendedString)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfExtendedString)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const TCollection_ExtendedString& theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT TCollection_ExtendedString GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -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 Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); - -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); - -Standard_EXPORT ~SALOMEDS_TableOfStringAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TableOfStringAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -SALOMEDS_DataMapOfIntegerString myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.ixx b/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.ixx deleted file mode 100644 index aa0392411..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.ixx +++ /dev/null @@ -1,67 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfStringAttribute.ixx -// Author : Sergey Ruin -// Module : SALOME - -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TableOfStringAttribute::~SALOMEDS_TableOfStringAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TableOfStringAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TableOfStringAttribute", - sizeof(SALOMEDS_TableOfStringAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TableOfStringAttribute) Handle(SALOMEDS_TableOfStringAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TableOfStringAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TableOfStringAttribute))) { - _anOtherObject = Handle(SALOMEDS_TableOfStringAttribute)((Handle(SALOMEDS_TableOfStringAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TableOfStringAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TableOfStringAttribute) ; -} -Standard_Boolean SALOMEDS_TableOfStringAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TableOfStringAttribute) == AType || TDF_Attribute::IsKind(AType)); -} -Handle_SALOMEDS_TableOfStringAttribute::~Handle_SALOMEDS_TableOfStringAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.jxx b/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.jxx deleted file mode 100644 index 23c515f83..000000000 --- a/src/SALOMEDS/SALOMEDS_TableOfStringAttribute.jxx +++ /dev/null @@ -1,34 +0,0 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDS_TableOfStringAttribute.jxx -// Author : Sergey Ruin -// Module : SALOME - -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TCollection_ExtendedString_HeaderFile -#include -#endif -#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TableOfStringAttribute_HeaderFile -#include -#endif diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.cdl b/src/SALOMEDS/SALOMEDS_TargetAttribute.cdl deleted file mode 100644 index 75b1190a0..000000000 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.cdl +++ /dev/null @@ -1,70 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.cxx b/src/SALOMEDS/SALOMEDS_TargetAttribute.cxx deleted file mode 100644 index 455c745fa..000000000 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.cxx +++ /dev/null @@ -1,122 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TargetAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TargetAttribute.ixx" -#include -#include -#include "utilities.h" -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TargetAttribute::GetID () -{ - static Standard_GUID SALOMEDS_TargetAttributeID ("12837197-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TargetAttributeID; -} - - - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -Handle(SALOMEDS_TargetAttribute) SALOMEDS_TargetAttribute::Set (const TDF_Label& L) -{ - Handle(SALOMEDS_TargetAttribute) A; - if (!L.FindAttribute(SALOMEDS_TargetAttribute::GetID(),A)) { - A = new SALOMEDS_TargetAttribute(); - L.AddAttribute(A); - } - return A; -} - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_TargetAttribute::SALOMEDS_TargetAttribute() -{} - -//======================================================================= -//function : Append -//purpose : -//======================================================================= - -void SALOMEDS_TargetAttribute::Append(TDF_Label& theReferencedObject) { - Backup(); - Handle(TDF_Reference) aReference; - if (theReferencedObject.FindAttribute(TDF_Reference::GetID(),aReference)) { - TDF_ListIteratorOfAttributeList anIter(GetVariables()); - for(;anIter.More();anIter.Next()) if(anIter.Value()->Label() == theReferencedObject) return; //BugID: PAL6192 - GetVariables().Append(aReference); - } else { - MESSAGE("SALOMEDS_TargetAttribute::Append: can't append referenced object"); - } -} - -//======================================================================= -//function : Get -//purpose : -//======================================================================= -void SALOMEDS_TargetAttribute::Get(TDF_LabelList& theReferencedObjects) { - theReferencedObjects.Clear(); - TDF_ListIteratorOfAttributeList anIter(GetVariables()); - for(;anIter.More();anIter.Next()) { - theReferencedObjects.Append(anIter.Value()->Label()); - } -} - -//======================================================================= -//function : Remove -//purpose : -//======================================================================= -void SALOMEDS_TargetAttribute::Remove(TDF_Label& theReferencedObject) { - Backup(); - TDF_ListIteratorOfAttributeList anIter(GetVariables()); - for(;anIter.More();anIter.Next()) { - if (anIter.Value()->Label() == theReferencedObject) { - GetVariables().Remove(anIter); - return; - } - } - MESSAGE("SALOMEDS_TargetAttribute::Remove: nothing to remove"); -} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TargetAttribute::ID () const { return GetID(); } - diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.hxx b/src/SALOMEDS/SALOMEDS_TargetAttribute.hxx deleted file mode 100644 index 89c9e487c..000000000 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.hxx +++ /dev/null @@ -1,133 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TargetAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_TargetAttribute_HeaderFile -#define _SALOMEDS_TargetAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TargetAttribute_HeaderFile -#include -#endif - -#include -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _TDF_LabelList_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Reference_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Label; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_TargetAttribute : public TDataStd_Relation { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDS_TargetAttribute Set(const TDF_Label& label) ; -Standard_EXPORT SALOMEDS_TargetAttribute(); -Standard_EXPORT void SALOMEDS_TargetAttribute::Append(TDF_Label& theReferencedObject); -Standard_EXPORT void SALOMEDS_TargetAttribute::Get(TDF_LabelList& theReferencedObjects); -Standard_EXPORT void SALOMEDS_TargetAttribute::Remove(TDF_Label& theReferencedObject); -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 ~SALOMEDS_TargetAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TargetAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.ixx b/src/SALOMEDS/SALOMEDS_TargetAttribute.ixx deleted file mode 100644 index c6d2ed299..000000000 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TargetAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TargetAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TargetAttribute::~SALOMEDS_TargetAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TargetAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Relation); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Relation); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TargetAttribute", - sizeof(SALOMEDS_TargetAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TargetAttribute) Handle(SALOMEDS_TargetAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TargetAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TargetAttribute))) { - _anOtherObject = Handle(SALOMEDS_TargetAttribute)((Handle(SALOMEDS_TargetAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TargetAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TargetAttribute) ; -} -Standard_Boolean SALOMEDS_TargetAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TargetAttribute) == AType || TDataStd_Relation::IsKind(AType)); -} -Handle_SALOMEDS_TargetAttribute::~Handle_SALOMEDS_TargetAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.jxx b/src/SALOMEDS/SALOMEDS_TargetAttribute.jxx deleted file mode 100644 index 514c1372a..000000000 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.jxx +++ /dev/null @@ -1,43 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TargetAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TargetAttribute_HeaderFile -#include "SALOMEDS_TargetAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl b/src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl deleted file mode 100644 index 5719628e8..000000000 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.cdl +++ /dev/null @@ -1,69 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx b/src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx deleted file mode 100644 index d2f1f321a..000000000 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.cxx +++ /dev/null @@ -1,93 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextColorAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TextColorAttribute.ixx" -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TextColorAttribute::GetID () -{ - static Standard_GUID SALOMEDS_TextColorAttributeID ("12837189-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TextColorAttributeID; -} - - - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_TextColorAttribute::SALOMEDS_TextColorAttribute() -{Init(1,3);} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TextColorAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_TextColorAttribute::NewEmpty () const -{ - return new SALOMEDS_TextColorAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_TextColorAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Handle(TColStd_HArray1OfReal) s = Handle(TDataStd_RealArray)::DownCast (with)->Array (); - TDataStd_RealArray::ChangeArray(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_TextColorAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const -{ - Handle(TDataStd_RealArray)::DownCast (into)->ChangeArray (Array()); -} - diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.hxx b/src/SALOMEDS/SALOMEDS_TextColorAttribute.hxx deleted file mode 100644 index 94c2c8e46..000000000 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.hxx +++ /dev/null @@ -1,122 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextColorAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_TextColorAttribute_HeaderFile -#define _SALOMEDS_TextColorAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TextColorAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_RealArray_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_TextColorAttribute : public TDataStd_RealArray { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT SALOMEDS_TextColorAttribute(); -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 ~SALOMEDS_TextColorAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TextColorAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.ixx b/src/SALOMEDS/SALOMEDS_TextColorAttribute.ixx deleted file mode 100644 index c2a12b9da..000000000 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextColorAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TextColorAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TextColorAttribute::~SALOMEDS_TextColorAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TextColorAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_RealArray); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_RealArray); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TextColorAttribute", - sizeof(SALOMEDS_TextColorAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TextColorAttribute) Handle(SALOMEDS_TextColorAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TextColorAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TextColorAttribute))) { - _anOtherObject = Handle(SALOMEDS_TextColorAttribute)((Handle(SALOMEDS_TextColorAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TextColorAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TextColorAttribute) ; -} -Standard_Boolean SALOMEDS_TextColorAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TextColorAttribute) == AType || TDataStd_RealArray::IsKind(AType)); -} -Handle_SALOMEDS_TextColorAttribute::~Handle_SALOMEDS_TextColorAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx b/src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx deleted file mode 100644 index 739fc44e4..000000000 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx +++ /dev/null @@ -1,40 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextColorAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TextColorAttribute_HeaderFile -#include "SALOMEDS_TextColorAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cdl b/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cdl deleted file mode 100644 index f3616de1e..000000000 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cdl +++ /dev/null @@ -1,68 +0,0 @@ --- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, --- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS --- --- This library is free software; you can redistribute it and/or --- modify it under the terms of the GNU Lesser General Public --- License as published by the Free Software Foundation; either --- version 2.1 of the License. --- --- This library is distributed in the hope that it will be useful --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --- Lesser General Public License for more details. --- --- You should have received a copy of the GNU Lesser General Public --- License along with this library; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --- --- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com --- --- File : SALOMEDS_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; diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cxx b/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cxx deleted file mode 100644 index a34648996..000000000 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.cxx +++ /dev/null @@ -1,92 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextHighlightColorAttribute.cxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TextHighlightColorAttribute.ixx" -using namespace std; - -//======================================================================= -//function : GetID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TextHighlightColorAttribute::GetID () -{ - static Standard_GUID SALOMEDS_TextHighlightColorAttributeID ("12837190-8F52-11d6-A8A3-0001021E8C7F"); - return SALOMEDS_TextHighlightColorAttributeID; -} - - - -//======================================================================= -//function : constructor -//purpose : -//======================================================================= -SALOMEDS_TextHighlightColorAttribute::SALOMEDS_TextHighlightColorAttribute() -{Init(1,3);} - -//======================================================================= -//function : ID -//purpose : -//======================================================================= - -const Standard_GUID& SALOMEDS_TextHighlightColorAttribute::ID () const { return GetID(); } - - -//======================================================================= -//function : NewEmpty -//purpose : -//======================================================================= - -Handle(TDF_Attribute) SALOMEDS_TextHighlightColorAttribute::NewEmpty () const -{ - return new SALOMEDS_TextHighlightColorAttribute(); -} - -//======================================================================= -//function : Restore -//purpose : -//======================================================================= - -void SALOMEDS_TextHighlightColorAttribute::Restore(const Handle(TDF_Attribute)& with) -{ - Handle(TColStd_HArray1OfReal) s = Handle(TDataStd_RealArray)::DownCast (with)->Array (); - TDataStd_RealArray::ChangeArray(s); - return; -} - -//======================================================================= -//function : Paste -//purpose : -//======================================================================= - -void SALOMEDS_TextHighlightColorAttribute::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const -{ - Handle(TDataStd_RealArray)::DownCast (into)->ChangeArray (Array()); -} - diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.hxx b/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.hxx deleted file mode 100644 index a39113617..000000000 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.hxx +++ /dev/null @@ -1,122 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextHighlightColorAttribute.hxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _SALOMEDS_TextHighlightColorAttribute_HeaderFile -#define _SALOMEDS_TextHighlightColorAttribute_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_SALOMEDS_TextHighlightColorAttribute_HeaderFile -#include -#endif - -#ifndef _TDataStd_RealArray_HeaderFile -#include -#endif -#ifndef _Handle_TDF_Attribute_HeaderFile -#include -#endif -#ifndef _Handle_TDF_RelocationTable_HeaderFile -#include -#endif -class Standard_GUID; -class TDF_Attribute; -class TDF_RelocationTable; - - -class SALOMEDS_TextHighlightColorAttribute : public TDataStd_RealArray { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } -// inline void operator delete(void *anAddress, size_t size) -// { -// if (anAddress) Standard::Free((Standard_Address&)anAddress,size); -// } - // Methods PUBLIC - // -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT SALOMEDS_TextHighlightColorAttribute(); -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 ~SALOMEDS_TextHighlightColorAttribute(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TextHighlightColorAttribute_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.ixx b/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.ixx deleted file mode 100644 index 186f0ab00..000000000 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.ixx +++ /dev/null @@ -1,87 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextHighlightColorAttribute.ixx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#include "SALOMEDS_TextHighlightColorAttribute.jxx" - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -SALOMEDS_TextHighlightColorAttribute::~SALOMEDS_TextHighlightColorAttribute() {} - - - -Standard_EXPORT Handle_Standard_Type& SALOMEDS_TextHighlightColorAttribute_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_RealArray); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_RealArray); - static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); - static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TextHighlightColorAttribute", - sizeof(SALOMEDS_TextHighlightColorAttribute), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(SALOMEDS_TextHighlightColorAttribute) Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(SALOMEDS_TextHighlightColorAttribute) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute))) { - _anOtherObject = Handle(SALOMEDS_TextHighlightColorAttribute)((Handle(SALOMEDS_TextHighlightColorAttribute)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& SALOMEDS_TextHighlightColorAttribute::DynamicType() const -{ - return STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute) ; -} -Standard_Boolean SALOMEDS_TextHighlightColorAttribute::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute) == AType || TDataStd_RealArray::IsKind(AType)); -} -Handle_SALOMEDS_TextHighlightColorAttribute::~Handle_SALOMEDS_TextHighlightColorAttribute() {} - diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx b/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx deleted file mode 100644 index 1320ad1d9..000000000 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx +++ /dev/null @@ -1,40 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOMEDS_TextHighlightColorAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ - -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include -#endif -#ifndef _SALOMEDS_TextHighlightColorAttribute_HeaderFile -#include "SALOMEDS_TextHighlightColorAttribute.hxx" -#endif diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx index c89cb6ff3..7080df22f 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx @@ -32,12 +32,11 @@ #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_UseCaseIterator.hxx" -#include #include using namespace std; -SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(const Handle(SALOMEDSImpl_UseCaseBuilder)& theBuilder) +SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(SALOMEDSImpl_UseCaseBuilder* theBuilder) { _isLocal = true; _local_impl = theBuilder; @@ -62,7 +61,7 @@ bool SALOMEDS_UseCaseBuilder::Append(const _PTR(SObject)& theObject) SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->Append(obj->GetLocalImpl()); + ret = _local_impl->Append(*(obj->GetLocalImpl())); } else ret = _corba_impl->Append(obj->GetCORBAImpl()); return ret; @@ -74,7 +73,7 @@ bool SALOMEDS_UseCaseBuilder::Remove(const _PTR(SObject)& theObject) SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->Remove(obj->GetLocalImpl()); + ret = _local_impl->Remove(*(obj->GetLocalImpl())); } else ret = _corba_impl->Remove(obj->GetCORBAImpl()); return ret; @@ -87,7 +86,7 @@ bool SALOMEDS_UseCaseBuilder::AppendTo(const _PTR(SObject)& theFather, _PTR(SObj SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->AppendTo(father->GetLocalImpl(), obj->GetLocalImpl()); + ret = _local_impl->AppendTo(*(father->GetLocalImpl()), *(obj->GetLocalImpl())); } else ret = _corba_impl->AppendTo(father->GetCORBAImpl(), obj->GetCORBAImpl()); return ret; @@ -100,7 +99,7 @@ bool SALOMEDS_UseCaseBuilder::InsertBefore(const _PTR(SObject)& theFirst, _PTR(S SALOMEDS_SObject* next = dynamic_cast(theNext.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->InsertBefore(first->GetLocalImpl(), next->GetLocalImpl()); + ret = _local_impl->InsertBefore(*(first->GetLocalImpl()), *(next->GetLocalImpl())); } else ret = _corba_impl->InsertBefore(first->GetCORBAImpl(), next->GetCORBAImpl()); return ret; @@ -112,7 +111,7 @@ bool SALOMEDS_UseCaseBuilder::SetCurrentObject(const _PTR(SObject)& theObject) SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->SetCurrentObject(obj->GetLocalImpl()); + ret = _local_impl->SetCurrentObject(*(obj->GetLocalImpl())); } else ret = _corba_impl->SetCurrentObject(obj->GetCORBAImpl()); return ret; @@ -135,7 +134,7 @@ bool SALOMEDS_UseCaseBuilder::HasChildren(const _PTR(SObject)& theObject) SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->HasChildren(obj->GetLocalImpl()); + ret = _local_impl->HasChildren(*(obj->GetLocalImpl())); } else ret = _corba_impl->HasChildren(obj->GetCORBAImpl()); return ret; @@ -147,7 +146,7 @@ bool SALOMEDS_UseCaseBuilder::IsUseCase(const _PTR(SObject)& theObject) SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->IsUseCase(obj->GetLocalImpl()); + ret = _local_impl->IsUseCase(*(obj->GetLocalImpl())); } else ret = _corba_impl->IsUseCase(obj->GetCORBAImpl()); return ret; @@ -158,7 +157,7 @@ bool SALOMEDS_UseCaseBuilder::SetName(const std::string& theName) bool ret; if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->SetName((char*)theName.c_str()); + ret = _local_impl->SetName(theName); } else ret = _corba_impl->SetName((char*)theName.c_str()); return ret; @@ -180,7 +179,7 @@ std::string SALOMEDS_UseCaseBuilder::GetName() std::string aName; if (_isLocal) { SALOMEDS::Locker lock; - aName = _local_impl->GetName().ToCString(); + aName = _local_impl->GetName(); } else aName = _corba_impl->GetName(); return aName; @@ -191,7 +190,7 @@ _PTR(SObject) SALOMEDS_UseCaseBuilder::AddUseCase(const std::string& theName) SALOMEDS_SObject* obj = NULL; if (_isLocal) { SALOMEDS::Locker lock; - obj = new SALOMEDS_SObject(_local_impl->AddUseCase((char*)theName.c_str())); + obj = new SALOMEDS_SObject(_local_impl->AddUseCase(theName)); } else obj = new SALOMEDS_SObject(_corba_impl->AddUseCase((char*)theName.c_str())); return _PTR(SObject)(obj); @@ -204,9 +203,9 @@ _PTR(UseCaseIterator) SALOMEDS_UseCaseBuilder::GetUseCaseIterator(const _PTR(SOb if (_isLocal) { SALOMEDS::Locker lock; if(obj) - it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl())); - else - it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(NULL)); + it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(*(obj->GetLocalImpl()))); + else + it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(SALOMEDSImpl_SObject())); } else { if(obj) diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx index 2dd2fc657..d39db68bc 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx @@ -36,12 +36,12 @@ class SALOMEDS_UseCaseBuilder: public SALOMEDSClient_UseCaseBuilder private: bool _isLocal; - Handle(SALOMEDSImpl_UseCaseBuilder) _local_impl; - SALOMEDS::UseCaseBuilder_var _corba_impl; + SALOMEDSImpl_UseCaseBuilder* _local_impl; + SALOMEDS::UseCaseBuilder_var _corba_impl; public: - SALOMEDS_UseCaseBuilder(const Handle(SALOMEDSImpl_UseCaseBuilder)& theBuilder); + SALOMEDS_UseCaseBuilder(SALOMEDSImpl_UseCaseBuilder* theBuilder); SALOMEDS_UseCaseBuilder(SALOMEDS::UseCaseBuilder_ptr theBuilder); ~SALOMEDS_UseCaseBuilder(); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx index 6997908eb..39b5061cc 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx @@ -36,7 +36,7 @@ using namespace std; * Purpose : */ //============================================================================ -SALOMEDS_UseCaseBuilder_i::SALOMEDS_UseCaseBuilder_i(const Handle(SALOMEDSImpl_UseCaseBuilder)& theImpl, +SALOMEDS_UseCaseBuilder_i::SALOMEDS_UseCaseBuilder_i(SALOMEDSImpl_UseCaseBuilder* theImpl, CORBA::ORB_ptr orb) { _orb = CORBA::ORB::_duplicate(orb); @@ -61,7 +61,7 @@ SALOMEDS_UseCaseBuilder_i::~SALOMEDS_UseCaseBuilder_i() CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Append(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; - if(_impl.IsNull() || theObject->_is_nil()) return 0; + if(!_impl || theObject->_is_nil()) return 0; return _impl->Append(_impl->GetSObject(theObject->GetID())); } @@ -73,7 +73,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Append(SALOMEDS::SObject_ptr theObject CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Remove(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; - if(_impl.IsNull() || theObject->_is_nil()) return 0; + if(!_impl || theObject->_is_nil()) return 0; return _impl->Remove(_impl->GetSObject(theObject->GetID())); } @@ -87,7 +87,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::AppendTo(SALOMEDS::SObject_ptr theFath SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; - if(_impl.IsNull() || theFather->_is_nil() || theObject->_is_nil()) return 0; + if(!_impl || theFather->_is_nil() || theObject->_is_nil()) return 0; return _impl->AppendTo(_impl->GetSObject(theFather->GetID()), _impl->GetSObject(theObject->GetID())); } @@ -100,7 +100,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::InsertBefore(SALOMEDS::SObject_ptr the SALOMEDS::SObject_ptr theNext) { SALOMEDS::Locker lock; - if(_impl.IsNull() || theFirst->_is_nil() || theNext->_is_nil()) return 0; + if(!_impl || theFirst->_is_nil() || theNext->_is_nil()) return 0; return _impl->InsertBefore(_impl->GetSObject(theFirst->GetID()), _impl->GetSObject(theNext->GetID())); } @@ -113,7 +113,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::InsertBefore(SALOMEDS::SObject_ptr the CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetCurrentObject(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; - if(_impl.IsNull() || theObject->_is_nil()) return 0; + if(!_impl || theObject->_is_nil()) return 0; return _impl->SetCurrentObject(_impl->GetSObject(theObject->GetID())); } @@ -125,7 +125,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetCurrentObject(SALOMEDS::SObject_ptr CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetRootCurrent() { SALOMEDS::Locker lock; - if(_impl.IsNull()) return 0; + if(!_impl) return 0; return _impl->SetRootCurrent(); } @@ -137,7 +137,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetRootCurrent() CORBA::Boolean SALOMEDS_UseCaseBuilder_i::HasChildren(SALOMEDS::SObject_ptr theObject) { SALOMEDS::Locker lock; - if(_impl.IsNull()) return 0; + if(!_impl) return 0; return _impl->HasChildren(_impl->GetSObject(theObject->GetID())); } @@ -149,7 +149,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::HasChildren(SALOMEDS::SObject_ptr theO CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetName(const char* theName) { SALOMEDS::Locker lock; - if(_impl.IsNull()) return 0; + if(!_impl) return 0; return _impl->SetName((char*)theName); } @@ -163,8 +163,8 @@ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::GetCurrentObject() { SALOMEDS::Locker lock; - if(_impl.IsNull()) return NULL; - Handle(SALOMEDSImpl_SObject) aSO = _impl->GetCurrentObject(); + if(!_impl) return NULL; + SALOMEDSImpl_SObject aSO = _impl->GetCurrentObject(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); } @@ -177,7 +177,7 @@ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::GetCurrentObject() char* SALOMEDS_UseCaseBuilder_i::GetName() { SALOMEDS::Locker lock; - return CORBA::string_dup(_impl->GetName().ToCString()); + return CORBA::string_dup(_impl->GetName().c_str()); } //============================================================================ @@ -189,7 +189,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::IsUseCase(SALOMEDS::SObject_ptr theObj { SALOMEDS::Locker lock; - if(_impl.IsNull() || theObject->_is_nil()) return false; + if(!_impl || theObject->_is_nil()) return false; return _impl->IsUseCase(_impl->GetSObject(theObject->GetID())); } @@ -202,8 +202,8 @@ 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); + if(!_impl) return SALOMEDS::SObject::_nil(); + SALOMEDSImpl_SObject aSO = _impl->AddUseCase((char*)theName); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); } @@ -217,10 +217,10 @@ SALOMEDS::UseCaseIterator_ptr SALOMEDS_UseCaseBuilder_i::GetUseCaseIterator(SALO { SALOMEDS::Locker lock; - if(_impl.IsNull()) return SALOMEDS::UseCaseIterator::_nil(); - Handle(SALOMEDSImpl_UseCaseIterator) anItr; + if(!_impl) return SALOMEDS::UseCaseIterator::_nil(); + SALOMEDSImpl_UseCaseIterator anItr; if(!CORBA::is_nil(theObject)) anItr = _impl->GetUseCaseIterator(_impl->GetSObject(theObject->GetID())); - else anItr = _impl->GetUseCaseIterator(NULL); + else anItr = _impl->GetUseCaseIterator(SALOMEDSImpl_SObject()); SALOMEDS_UseCaseIterator_i* aServant = new SALOMEDS_UseCaseIterator_i(anItr, _orb); SALOMEDS::UseCaseIterator_var anIterator = SALOMEDS::UseCaseIterator::_narrow(aServant->_this()); return anIterator._retn(); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx index 895d1c027..e5a433178 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx @@ -33,8 +33,6 @@ #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) #include -// Cascade headers -#include #include #include "SALOMEDSImpl_UseCaseIterator.hxx" @@ -46,13 +44,13 @@ class SALOMEDS_UseCaseBuilder_i: public virtual POA_SALOMEDS::UseCaseBuilder, { private: - CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_UseCaseBuilder) _impl; + CORBA::ORB_ptr _orb; + SALOMEDSImpl_UseCaseBuilder* _impl; public: //! standard constructor - SALOMEDS_UseCaseBuilder_i(const Handle(SALOMEDSImpl_UseCaseBuilder)& theDocument, + SALOMEDS_UseCaseBuilder_i(SALOMEDSImpl_UseCaseBuilder* theDocument, CORBA::ORB_ptr); //! standard destructor diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx index 9fc21d122..5717c654b 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx @@ -30,40 +30,40 @@ using namespace std; -SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator) +SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(const SALOMEDSImpl_UseCaseIterator& theIterator) { _isLocal = true; - _local_impl = theIterator; + _local_impl = theIterator.GetPersistentCopy(); _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(); + else if(_local_impl) delete _local_impl; } void SALOMEDS_UseCaseIterator::Init(bool theAllLevels) { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->Init(theAllLevels); + if(_local_impl) _local_impl->Init(theAllLevels); } else _corba_impl->Init(theAllLevels); } bool SALOMEDS_UseCaseIterator::More() { - bool ret; + bool ret = false; if (_isLocal) { SALOMEDS::Locker lock; - ret = _local_impl->More(); + if(_local_impl) ret = _local_impl->More(); } else ret = _corba_impl->More(); return ret; @@ -73,17 +73,17 @@ void SALOMEDS_UseCaseIterator::Next() { if (_isLocal) { SALOMEDS::Locker lock; - _local_impl->Next(); + if(_local_impl) _local_impl->Next(); } else _corba_impl->Next(); } _PTR(SObject) SALOMEDS_UseCaseIterator::Value() { - SALOMEDS_SObject* aSO; + SALOMEDS_SObject* aSO = NULL; if (_isLocal) { SALOMEDS::Locker lock; - aSO = new SALOMEDS_SObject(_local_impl->Value()); + if(_local_impl) aSO = new SALOMEDS_SObject(_local_impl->Value()); } else aSO = new SALOMEDS_SObject(_corba_impl->Value()); return _PTR(SObject)(aSO); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx index fa82213a4..29f5d24a8 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator.hxx @@ -36,12 +36,12 @@ class SALOMEDS_UseCaseIterator: public SALOMEDSClient_UseCaseIterator { private: bool _isLocal; - Handle(SALOMEDSImpl_UseCaseIterator) _local_impl; - SALOMEDS::UseCaseIterator_var _corba_impl; + SALOMEDSImpl_UseCaseIterator* _local_impl; + SALOMEDS::UseCaseIterator_var _corba_impl; public: - SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator); + SALOMEDS_UseCaseIterator(const SALOMEDSImpl_UseCaseIterator& theIterator); SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr theIterator); ~SALOMEDS_UseCaseIterator(); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx index db1624eb4..1037dbcce 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx @@ -36,11 +36,11 @@ using namespace std; * Purpose : */ //============================================================================ -SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl_UseCaseIterator)& theImpl, +SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const SALOMEDSImpl_UseCaseIterator& theImpl, CORBA::ORB_ptr orb) { _orb = CORBA::ORB::_duplicate(orb); - _impl = theImpl; + _impl = theImpl.GetPersistentCopy(); } //============================================================================ @@ -50,6 +50,7 @@ SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl //============================================================================ SALOMEDS_UseCaseIterator_i::~SALOMEDS_UseCaseIterator_i() { + if(_impl) delete _impl; } //============================================================================ @@ -60,7 +61,7 @@ SALOMEDS_UseCaseIterator_i::~SALOMEDS_UseCaseIterator_i() void SALOMEDS_UseCaseIterator_i::Init(CORBA::Boolean allLevels) { SALOMEDS::Locker lock; - _impl->Init(allLevels); + if(_impl) _impl->Init(allLevels); } //============================================================================ @@ -71,6 +72,7 @@ void SALOMEDS_UseCaseIterator_i::Init(CORBA::Boolean allLevels) CORBA::Boolean SALOMEDS_UseCaseIterator_i::More() { SALOMEDS::Locker lock; + if(!_impl) return false; return _impl->More(); } @@ -82,7 +84,7 @@ CORBA::Boolean SALOMEDS_UseCaseIterator_i::More() void SALOMEDS_UseCaseIterator_i::Next() { SALOMEDS::Locker lock; - _impl->Next(); + if(_impl) _impl->Next(); } @@ -94,7 +96,8 @@ void SALOMEDS_UseCaseIterator_i::Next() SALOMEDS::SObject_ptr SALOMEDS_UseCaseIterator_i::Value() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->Value(); + if(!_impl) return SALOMEDS::SObject::_nil(); + SALOMEDSImpl_SObject aSO = _impl->Value(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); } diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx index 0f4262039..b1e58a30d 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx @@ -40,12 +40,12 @@ class SALOMEDS_UseCaseIterator_i: public virtual POA_SALOMEDS::UseCaseIterator, { private: CORBA::ORB_ptr _orb; - Handle(SALOMEDSImpl_UseCaseIterator) _impl; + SALOMEDSImpl_UseCaseIterator* _impl; public: //! standard constructor - SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl_UseCaseIterator)& theImpl, + SALOMEDS_UseCaseIterator_i(const SALOMEDSImpl_UseCaseIterator& theImpl, CORBA::ORB_ptr); //! standard destructor diff --git a/src/SALOMEDS/SALOME_DriverPy.py b/src/SALOMEDS/SALOME_DriverPy.py index 9e8f5264a..8346a3979 100644 --- a/src/SALOMEDS/SALOME_DriverPy.py +++ b/src/SALOMEDS/SALOME_DriverPy.py @@ -38,7 +38,7 @@ class SALOME_DriverPy_i(SALOMEDS__POA.Driver): return self._ComponentDataType def Save(self, theComponent, theURL, isMultiFile): - return "" + return NULL def SaveASCII(self, theComponent, theURL, isMultiFile): return self.Save(theComponent, theURL, isMultiFile) @@ -56,7 +56,7 @@ class SALOME_DriverPy_i(SALOMEDS__POA.Driver): return 1 def PublishInStudy(self, theStudy, theSObject, theObject, theName): - return None + return NULL def CanCopy(self, theObject): return 0 diff --git a/src/SALOMEDS/Test/Makefile.am b/src/SALOMEDS/Test/Makefile.am index 529db807b..79200aafc 100644 --- a/src/SALOMEDS/Test/Makefile.am +++ b/src/SALOMEDS/Test/Makefile.am @@ -59,11 +59,11 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ -I$(srcdir)/$(RPATH)/SALOMEDS \ -I$(srcdir)/$(RPATH)/SALOMEDSClient \ - -I$(srcdir)/$(RPATH)/SALOMEDSImpl -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \ + -I$(srcdir)/$(RPATH)/DF \ + -I$(srcdir)/$(RPATH)/SALOMEDSImpl -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ - @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ @@ -80,6 +80,7 @@ COMMON_LIBS =\ $(RPATH)/SALOMELocalTrace/libSALOMELocalTrace.la \ $(RPATH)/SALOMETraceCollector/Test/libSALOMETraceCollectorTest.la \ $(RPATH)/SALOMEDSImpl/Test/libSALOMEDSImplTest.la \ + $(RPATH)/DF/libDF.la \ $(RPATH)/SALOMEDSImpl/libSalomeDSImpl.la \ $(RPATH)/SALOMEDSClient/libSalomeDSClient.la \ $(RPATH)/SALOMEDS/libSalomeDS.la \ diff --git a/src/SALOMEDS/Test/SALOMEDSTest.cxx b/src/SALOMEDS/Test/SALOMEDSTest.cxx index 0b728667b..68de91733 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.cxx @@ -40,9 +40,6 @@ #include "SALOMEDS_SObject.hxx" -#include -#include - using namespace std; // ============================================================================ @@ -53,8 +50,8 @@ using namespace std; void SALOMEDSTest::setUp() { - int argc = 1; - char* argv[] = {""}; + int argc = 1; + char* argv[] = {""}; ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()); @@ -130,8 +127,8 @@ void SALOMEDSTest::tearDown() void SALOMEDSTest_Embedded::setUp() { - int argc = 1; - char* argv[] = {""}; + int argc = 1; + char* argv[] = {""}; ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()); diff --git a/src/SALOMEDS/Test/SALOMEDSTest.hxx b/src/SALOMEDS/Test/SALOMEDSTest.hxx index 6dcaed5e5..64165bbb1 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.hxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.hxx @@ -31,7 +31,7 @@ class SALOMEDSTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE( SALOMEDSTest ); //Attributes' tests - + CPPUNIT_TEST( testAttributeComment ); CPPUNIT_TEST( testAttributeDrawable ); CPPUNIT_TEST( testAttributeExpandable ); @@ -44,7 +44,7 @@ class SALOMEDSTest : public CppUnit::TestFixture CPPUNIT_TEST( testAttributeLocalID ); CPPUNIT_TEST( testAttributeName ); CPPUNIT_TEST( testAttributeOpened ); - CPPUNIT_TEST( testAttributeParameter ); + CPPUNIT_TEST( testAttributeParameter ); CPPUNIT_TEST( testAttributePersistentRef ); CPPUNIT_TEST( testAttributePixMap ); CPPUNIT_TEST( testAttributePythonObject ); @@ -53,8 +53,8 @@ class SALOMEDSTest : public CppUnit::TestFixture CPPUNIT_TEST( testAttributeSequenceOfInteger ); CPPUNIT_TEST( testAttributeSequenceOfReal ); CPPUNIT_TEST( testAttributeStudyProperties ); - CPPUNIT_TEST( testAttributeTableOfInteger ); - CPPUNIT_TEST( testAttributeTableOfReal ); + CPPUNIT_TEST( testAttributeTableOfInteger ); + CPPUNIT_TEST( testAttributeTableOfReal ); CPPUNIT_TEST( testAttributeTableOfString ); CPPUNIT_TEST( testAttributeTarget ); CPPUNIT_TEST( testAttributeTextColor ); @@ -65,7 +65,7 @@ class SALOMEDSTest : public CppUnit::TestFixture CPPUNIT_TEST( testSComponent ); CPPUNIT_TEST( testSComponentIterator ); CPPUNIT_TEST( testSObject ); - CPPUNIT_TEST( testStudy ); + CPPUNIT_TEST( testStudy ); CPPUNIT_TEST( testStudyBuilder ); CPPUNIT_TEST( testStudyManager ); CPPUNIT_TEST( testUseCase ); @@ -133,7 +133,7 @@ class SALOMEDSTest_Embedded : public SALOMEDSTest CPPUNIT_TEST_SUITE( SALOMEDSTest_Embedded ); //Attributes' tests - + CPPUNIT_TEST( testAttributeComment ); CPPUNIT_TEST( testAttributeDrawable ); CPPUNIT_TEST( testAttributeExpandable ); @@ -149,13 +149,13 @@ class SALOMEDSTest_Embedded : public SALOMEDSTest CPPUNIT_TEST( testAttributeParameter ); CPPUNIT_TEST( testAttributePersistentRef ); CPPUNIT_TEST( testAttributePixMap ); - CPPUNIT_TEST( testAttributePythonObject ); + CPPUNIT_TEST( testAttributePythonObject ); CPPUNIT_TEST( testAttributeReal ); CPPUNIT_TEST( testAttributeSelectable ); CPPUNIT_TEST( testAttributeSequenceOfInteger ); CPPUNIT_TEST( testAttributeSequenceOfReal ); CPPUNIT_TEST( testAttributeStudyProperties ); - CPPUNIT_TEST( testAttributeTableOfInteger ); + CPPUNIT_TEST( testAttributeTableOfInteger ); CPPUNIT_TEST( testAttributeTableOfReal ); CPPUNIT_TEST( testAttributeTableOfString ); CPPUNIT_TEST( testAttributeTarget ); @@ -164,15 +164,15 @@ class SALOMEDSTest_Embedded : public SALOMEDSTest CPPUNIT_TEST( testAttributeTreeNode ); CPPUNIT_TEST( testAttributeUserID ); CPPUNIT_TEST( testChildIterator ); - CPPUNIT_TEST( testSComponent ); + CPPUNIT_TEST( testSComponent ); CPPUNIT_TEST( testSComponentIterator ); CPPUNIT_TEST( testSObject ); CPPUNIT_TEST( testStudy ); - CPPUNIT_TEST( testStudyBuilder ); + CPPUNIT_TEST( testStudyBuilder ); + CPPUNIT_TEST( testChildIterator ); CPPUNIT_TEST( testStudyManager ); CPPUNIT_TEST( testUseCase ); - - + CPPUNIT_TEST_SUITE_END(); public: diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx index 7d799d957..6fc220a12 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx @@ -53,17 +53,17 @@ void SALOMEDSTest::testAttributeExpandable() //Check method IsExpandable bool isExpandable = _attr->IsExpandable(); - CPPUNIT_ASSERT(!isExpandable); + CPPUNIT_ASSERT(isExpandable); //Check method SetExpandable - _attr->SetExpandable(true); - - CPPUNIT_ASSERT(_attr->IsExpandable()); - _attr->SetExpandable(false); CPPUNIT_ASSERT(!_attr->IsExpandable()); + _attr->SetExpandable(true); + + CPPUNIT_ASSERT(_attr->IsExpandable()); + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx index 67aaea942..3c02ae622 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx @@ -53,17 +53,17 @@ void SALOMEDSTest::testAttributeSelectable() //Check method IsSelectable bool isSelectable = _attr->IsSelectable(); - CPPUNIT_ASSERT(!isSelectable); + CPPUNIT_ASSERT(isSelectable); //Check method SetSelectable - _attr->SetSelectable(true); - - CPPUNIT_ASSERT(_attr->IsSelectable()); - _attr->SetSelectable(false); CPPUNIT_ASSERT(!_attr->IsSelectable()); + _attr->SetSelectable(true); + + CPPUNIT_ASSERT(_attr->IsSelectable()); + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx index 27371c474..b90507041 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx @@ -81,6 +81,7 @@ void SALOMEDSTest::testAttributeSequenceOfInteger() vector v = _attr->CorbaSequence(); CPPUNIT_ASSERT(v.size() == 3); + for(int i = 0; iSetTitle("Table_1"); @@ -86,17 +86,17 @@ void SALOMEDSTest::testAttributeTableOfInteger() vector rs = _attr->GetRowSetIndices(1); CPPUNIT_ASSERT(rs.size() == 1 && rs[0] == 1); -*/ + _attr->PutValue(32, 2,2); CPPUNIT_ASSERT(_attr->HasValue(2, 2)); -/* + vector rowTitles; rowTitles.push_back("title1"); rowTitles.push_back("title2"); //Check method SetRowTitles _attr->SetRowTitles(rowTitles); - + //Check method SetRowTitle _attr->SetRowTitle(1, "new_title"); @@ -118,9 +118,7 @@ void SALOMEDSTest::testAttributeTableOfInteger() //Check method GetColumnTitles vector ct = _attr->GetColumnTitles(); - CPPUNIT_ASSERT(ct.size() == 2 && ct[0] == "new_title" && ct[1] == "title2"); -*/ vector rowUnits; rowUnits.push_back("unit1"); @@ -129,8 +127,6 @@ void SALOMEDSTest::testAttributeTableOfInteger() //Check method SetRowUnits _attr->SetRowUnits(rowUnits); -/* - //Check method SetRowUnit _attr->SetRowUnit(1, "new_unit"); @@ -171,6 +167,7 @@ void SALOMEDSTest::testAttributeTableOfInteger() _attr->AddColumn(data); + CPPUNIT_ASSERT(_attr->GetNbColumns() == 3); //Check method GetColumn @@ -185,7 +182,7 @@ void SALOMEDSTest::testAttributeTableOfInteger() data2 = _attr->GetColumn(3); CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11 && data2[1] == -22 && data2[2] == -33); -*/ + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx index 75d1b2e40..e86d3ef58 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx @@ -105,7 +105,6 @@ void SALOMEDSTest::testAttributeTableOfReal() CPPUNIT_ASSERT(rt.size() == 2 && rt[0] == "new_title" && rt[1] == "title2"); - vector colTitles; colTitles.push_back("title1"); colTitles.push_back("title2"); diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx index c99bf75c6..de2f21099 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx @@ -67,7 +67,7 @@ void SALOMEDSTest::testAttributeTextColor() CPPUNIT_ASSERT(color.B == color2.B); - sm->Close(study); + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx index 23a7b9471..270ba559b 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx @@ -93,7 +93,7 @@ void SALOMEDSTest::testAttributeTreeNode() CPPUNIT_ASSERT(isRaised); _attr->Append(_attr2); - + //Check method HasNext CPPUNIT_ASSERT(_attr1->HasNext()); @@ -107,7 +107,7 @@ void SALOMEDSTest::testAttributeTreeNode() CPPUNIT_ASSERT(_attr2->GetPrevious()->Label() == _attr1->Label()); //Check method Depth - CPPUNIT_ASSERT(_attr->Depth() == 0 && _attr1->Depth() == 1); + CPPUNIT_ASSERT(_attr->Depth() == 1 && _attr1->Depth() == 2); //Check method IsRoot CPPUNIT_ASSERT(_attr->IsRoot()); @@ -125,6 +125,7 @@ void SALOMEDSTest::testAttributeTreeNode() //Check method Prepend _attr->Prepend(_attr2); + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr2->Label()); //Check possibility to Prepend to itself @@ -184,19 +185,9 @@ void SALOMEDSTest::testAttributeTreeNode() //Try to create the attribute with given TreeID string value = "0e1c36e6-1111-4d90-ab3b-18a14310e648"; - _PTR(AttributeTreeNode) _attr_guid = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNode"+value); + _PTR(AttributeTreeNode) _attr_guid = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNodeGUID"+value); CPPUNIT_ASSERT(_attr_guid && _attr_guid->GetTreeID() == value); - - //Try to set invalid GUID - isRaised = false; - try { - _attr->SetTreeID("invalid guid"); - } - catch(...) { - isRaised = true; - } - CPPUNIT_ASSERT(isRaised); - + sm->Close(study); } #undef SALOMEDS_ALL_TESTS diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx index 064b77de5..1af8beeba 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx @@ -62,18 +62,7 @@ void SALOMEDSTest::testAttributeUserID() value = "0e1c36e6-379b-4d90-ab3b-18a14310e648"; _PTR(AttributeUserID) _attr2 = studyBuilder->FindOrCreateAttribute(so, "AttributeUserID"+value); CPPUNIT_ASSERT(_attr2 && _attr2->Value() == value); - - //Try to set invalid GUID - bool isRaised = false; - try { - _attr->SetValue("invalid guid"); - } - catch(...) { - isRaised = true; - } - CPPUNIT_ASSERT(isRaised); - - + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx b/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx index bed9e9276..ac3f02690 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx @@ -71,7 +71,7 @@ void SALOMEDSTest::testChildIterator() //Check that there are two SObject under so CPPUNIT_ASSERT(count == 2); - + sm->Close(study); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx index 5b4d221fe..c79274f8b 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx @@ -99,6 +99,7 @@ void SALOMEDSTest::testSObject() //Check method GetAllAttributes vector< _PTR(GenericAttribute) > v = so->GetAllAttributes(); + CPPUNIT_ASSERT(v.size() == 5); //+AttributeTarget +AttributeTreeNode //Check method GetName diff --git a/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx b/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx index aef1f9c2a..1a34ea293 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx @@ -42,6 +42,7 @@ void SALOMEDSTest::testStudy() //Check method NewComponentIterator _PTR(SComponentIterator) componentIterator = study->NewComponentIterator(); + CPPUNIT_ASSERT(componentIterator); //Check method GetTransientReference @@ -342,7 +343,6 @@ void SALOMEDSTest::testStudy() isException = true; } CPPUNIT_ASSERT(!isException); - } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx b/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx index 4ce06a578..109ac0e2d 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx @@ -80,24 +80,16 @@ void SALOMEDSTest::testStudyBuilder() _PTR(AttributeName) an3 = studyBuilder->FindOrCreateAttribute(so3, "AttributeName"); CPPUNIT_ASSERT(an3); - cout << endl << "########## 1" << endl; - //Try to create attribute with invalid type CPPUNIT_ASSERT(!studyBuilder->FindOrCreateAttribute(so3, "invalid type")); - cout << endl << "########## 2" << endl; - //Check method FindAttribute _PTR(GenericAttribute) ga; CPPUNIT_ASSERT(studyBuilder->FindAttribute(so3, ga, "AttributeName")); - cout << endl << "########## 3" << endl; - //Try to find attribute with invalid type CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so3, ga, "invalid type")); - cout << endl << "########## 4" << endl; - //Check method RemoveObject studyBuilder->RemoveObject(so3); CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so3, ga, "AttributeName")); @@ -138,46 +130,14 @@ void SALOMEDSTest::testStudyBuilder() //Check method SetGUID and IsGUID string value = "0e1c36e6-379b-4d90-ab3b-17a14310e648"; studyBuilder->SetGUID(so1, value); - CPPUNIT_ASSERT(studyBuilder->IsGUID(so1, value)); - //Try to set invalid GUID - isRaised = false; - try { - studyBuilder->SetGUID(so1, "invalid GUID"); - } - catch(...) { - isRaised = true; - } - CPPUNIT_ASSERT(isRaised); + CPPUNIT_ASSERT(studyBuilder->IsGUID(so1, value)); +/* Not implemented //Check method UndoLimit (set/get) studyBuilder->UndoLimit(10); CPPUNIT_ASSERT(studyBuilder->UndoLimit() == 10); - - //Check transactions methods: NewCommand, CommitCommand, AbortCommand, - //HasOpenedCommand, Undo, Redo, GetAvailableUndos, GetAvailableRedos - _PTR(SObject) so4 = studyBuilder->NewObject(sco3); - CPPUNIT_ASSERT(so4); - studyBuilder->NewCommand(); - CPPUNIT_ASSERT(studyBuilder->HasOpenCommand()); - _PTR(AttributeName) an4 = studyBuilder->FindOrCreateAttribute(so4, "AttributeName"); - CPPUNIT_ASSERT(an4); - an4->SetValue("command1"); - studyBuilder->CommitCommand(); - CPPUNIT_ASSERT(!studyBuilder->HasOpenCommand()); - studyBuilder->NewCommand(); - an4->SetValue("command2"); - studyBuilder->AbortCommand(); - CPPUNIT_ASSERT(an4->Value() == "command1"); - studyBuilder->NewCommand(); - an4->SetValue("command2"); - studyBuilder->CommitCommand(); - studyBuilder->Undo(); - CPPUNIT_ASSERT(an4->Value() == "command1"); - CPPUNIT_ASSERT(studyBuilder->GetAvailableRedos()); - studyBuilder->Redo(); - CPPUNIT_ASSERT(an4->Value() == "command2"); - CPPUNIT_ASSERT(studyBuilder->GetAvailableUndos()); +*/ //Check method SetName studyBuilder->SetName(so1, "new name"); @@ -207,17 +167,19 @@ void SALOMEDSTest::testStudyBuilder() //Check method LoadWith _PTR(Study) study2 = sm->NewStudy("Study2"); - + SALOME_NamingService NS(_orb); - CORBA::Object_var obj = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("SuperVisionContainer", "SUPERV"); + CORBA::Object_var obj = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("FactoryServer", "SMESH"); CPPUNIT_ASSERT(!CORBA::is_nil(obj)); - MESSAGE("Created a new GEOM component"); + MESSAGE("Created a new SMESH component"); SALOMEDS::Driver_var drv = SALOMEDS::Driver::_narrow(obj); CPPUNIT_ASSERT(!CORBA::is_nil(drv)); + _PTR(StudyBuilder) sb2 = study2->NewBuilder(); - _PTR(SComponent) sco = sb2->NewComponent("SUPERV"); + _PTR(SComponent) sco = sb2->NewComponent("SMESH"); + ior = _orb->object_to_string(drv); sb2->DefineComponentInstance(sco, ior); @@ -226,22 +188,24 @@ void SALOMEDSTest::testStudyBuilder() _PTR(Study) study3 = sm->Open("srn_SALOMEDS_UnitTests.hdf"); _PTR(StudyBuilder) sb3 = study3->NewBuilder(); - _PTR(SComponent) aComp = study3->FindComponent("SUPERV"); + _PTR(SComponent) aComp = study3->FindComponent("SMESH"); CPPUNIT_ASSERT(aComp); - CORBA::Object_var obj2 = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("SuperVisionContainer", "SUPERV"); + CORBA::Object_var obj2 = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("FactoryServer", "SMESH"); CPPUNIT_ASSERT(!CORBA::is_nil(obj2)); SALOMEDS::Driver_var drv2 = SALOMEDS::Driver::_narrow(obj2); ior = _orb->object_to_string(drv2); isRaised = false; try { + //getchar(); sb3->LoadWith(aComp, ior); } catch(...) { isRaised = true; } + CPPUNIT_ASSERT(!isRaised); ior = ""; @@ -261,6 +225,7 @@ void SALOMEDSTest::testStudyBuilder() isRaised = true; } + CPPUNIT_ASSERT(!isRaised); _PTR(SObject) so5 = study3->FindObjectByPath("/Component/Dir1"); CPPUNIT_ASSERT(so5); @@ -281,5 +246,5 @@ void SALOMEDSTest::testStudyBuilder() } CPPUNIT_ASSERT(isRaised); - sm->Close(study3); + sm->Close(study3); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx b/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx index f20d68208..4f2f7369d 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx @@ -79,7 +79,6 @@ void SALOMEDSTest::testStudyManager() CPPUNIT_ASSERT(sm->Copy(so1)); - CPPUNIT_ASSERT(!sm->CanPaste(so1)); //The father component has no IOR _PTR(SObject) so1_2 = sb1->NewObject(sco1); @@ -90,7 +89,6 @@ void SALOMEDSTest::testStudyManager() CPPUNIT_ASSERT(na2 && na2->Value() == "Some name"); - //Check method SaveAs sm->SaveAs("srn_UnitTest_Save.hdf", study1, false); string url = study1->URL(); @@ -112,25 +110,31 @@ void SALOMEDSTest::testStudyManager() string soID = so3->GetID(); _PTR(AttributeName) na3 = sb3->FindOrCreateAttribute(so3, "AttributeName"); CPPUNIT_ASSERT(na3); + na3->SetValue("Saved study"); + // Save and close the study sm->Save(study1_opened, false); + sm->Close(study1_opened); // Open saved study and find the created SObject with AttributeName, then compare the stored string _PTR(Study) study2_opened = sm->Open("srn_UnitTest_Save.hdf"); + system("rm -f srn_UnitTest_Save.hdf"); + CPPUNIT_ASSERT(study2_opened); + _PTR(SObject) so4 = study2_opened->CreateObjectID(soID); _PTR(StudyBuilder) sb4 = study2_opened->NewBuilder(); _PTR(AttributeName) na4 = sb4->FindOrCreateAttribute(so4, "AttributeName"); CPPUNIT_ASSERT(na4 && na4->Value() == "Saved study"); //Compare the value of restored attribute with string that has to be saved. - //Check method SaveAsASCII sm->SaveAsASCII("srn_UnitTest_SaveASCII.hdf", study2_opened, false); url = study2_opened->URL(); sm->Close(study2_opened); + _PTR(Study) study3_opened = sm->Open("srn_UnitTest_SaveASCII.hdf"); //Contains Test component system("rm -f srn_UnitTest_SaveASCII.hdf"); CPPUNIT_ASSERT(study3_opened); diff --git a/src/SALOMEDS/Test/TestSALOMEDS.cxx b/src/SALOMEDS/Test/TestSALOMEDS.cxx index 59f32e47d..2d02b2829 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.cxx +++ b/src/SALOMEDS/Test/TestSALOMEDS.cxx @@ -24,8 +24,6 @@ #include "SALOMEDSImplTest.hxx" #include "SALOMEDSTest.hxx" -#include - // --- Registers the fixture into the 'registry' CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest ); @@ -108,8 +106,6 @@ int main(int argc, char* argv[]) string kernel_root = getenv("KERNEL_ROOT_DIR"); CPPUNIT_ASSERT(!kernel_root.empty()); kernel_root+="/share/salome/resources/kernel"; - setenv("CSF_PluginDefaults", kernel_root.c_str(), 1); - setenv("CSF_SALOMEDS_ResourcesDefaults", kernel_root.c_str(), 1); CORBA::Object_var poaObj = orb->resolve_initial_references("RootPOA"); if(!CORBA::is_nil(poaObj)) { diff --git a/src/SALOMEDS/Test/TestSALOMEDS.py b/src/SALOMEDS/Test/TestSALOMEDS.py index 01891488e..d2c162635 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.py +++ b/src/SALOMEDS/Test/TestSALOMEDS.py @@ -19,14 +19,13 @@ import sys, os,signal,string,commands import runSalome -import setenv import orbmodule import TestKiller # get SALOME environment : -args, modules_list, modules_root_dir = setenv.get_config() -setenv.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = runSalome.get_config() +runSalome.set_env(args, modules_list, modules_root_dir) # launch CORBA naming server diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index a228cac57..f1b3c72db 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -73,7 +73,6 @@ salomeinclude_HEADERS= \ SALOMEDSImpl_StudyBuilder.hxx \ SALOMEDSImpl_Study.hxx \ SALOMEDSImpl_StudyManager.hxx \ - SALOMEDSImpl_OCAFApplication.hxx \ SALOMEDSImpl_ChildNodeIterator.hxx \ SALOMEDSImpl_IParameters.hxx \ SALOMEDSImpl_TMPFile.hxx @@ -86,11 +85,12 @@ salomeinclude_HEADERS= \ # This local variable defines the list of CPPFLAGS common to all target in this package. COMMON_CPPFLAGS=\ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../HDFPersist \ - @HDF5_INCLUDES@ + -I$(srcdir)/../DF \ + @HDF5_INCLUDES@ \ + @BOOST_CPPFLAGS@ # This flag is used to resolve the dependencies of OCC libraries. LDXMUFLAGS = -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lXmu @@ -98,7 +98,7 @@ LDXMUFLAGS = -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lXmu # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ ../HDFPersist/libSalomeHDFPersist.la \ - @CAS_OCAF@ \ + ../DF/libDF.la \ @HDF5_LIBS@ \ $(LDXMUFLAGS) @@ -117,7 +117,6 @@ libSalomeDSImpl_la_SOURCES =\ SALOMEDSImpl_SObject.cxx \ SALOMEDSImpl_SComponent.cxx \ SALOMEDSImpl_ChildIterator.cxx \ - SALOMEDSImpl_OCAFApplication.cxx \ SALOMEDSImpl_AttributeIOR.cxx \ SALOMEDSImpl_AttributeExternalFileDef.cxx \ SALOMEDSImpl_AttributeFileType.cxx \ @@ -196,7 +195,6 @@ libSalomeDSImpl_la_SOURCES =\ SALOMEDSImpl_ChildNodeIterator.hxx \ SALOMEDSImpl_Driver.hxx \ SALOMEDSImpl_GenericAttribute.hxx \ - SALOMEDSImpl_OCAFApplication.hxx \ SALOMEDSImpl_SComponent.hxx \ SALOMEDSImpl_SComponentIterator.hxx \ SALOMEDSImpl_SObject.hxx \ diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.cxx index cbfa29b17..e76570dd1 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.cxx @@ -27,24 +27,21 @@ using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeComment::GetID () +const std::string& SALOMEDSImpl_AttributeComment::GetID () { - static Standard_GUID CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9"); + static std::string CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9"); return CommentID; } -Handle(SALOMEDSImpl_AttributeComment) SALOMEDSImpl_AttributeComment::Set (const TDF_Label& L, - const TCollection_ExtendedString& Val) +SALOMEDSImpl_AttributeComment* SALOMEDSImpl_AttributeComment::Set (const DF_Label& L, + const std::string& Val) { - Handle(SALOMEDSImpl_AttributeComment) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), A)) { + SALOMEDSImpl_AttributeComment* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeComment*)L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) { A = new SALOMEDSImpl_AttributeComment(); L.AddAttribute(A); } @@ -58,7 +55,7 @@ Handle(SALOMEDSImpl_AttributeComment) SALOMEDSImpl_AttributeComment::Set (const //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeComment::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributeComment::SetValue (const string& S) { CheckLocked(); @@ -76,13 +73,13 @@ void SALOMEDSImpl_AttributeComment::SetValue (const TCollection_ExtendedString& //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeComment::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeComment::NewEmpty () const { return new SALOMEDSImpl_AttributeComment(); } @@ -91,9 +88,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeComment::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeComment::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeComment::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeComment)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= @@ -101,8 +98,7 @@ void SALOMEDSImpl_AttributeComment::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeComment::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeComment::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeComment)::DownCast (into)->SetValue(myString); + dynamic_cast(into)->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.hxx index a7ad7221a..8f6e361b5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.hxx @@ -24,47 +24,38 @@ #ifndef _SALOMEDSImpl_AttributeComment_HeaderFile #define _SALOMEDSImpl_AttributeComment_HeaderFile -#include -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute ) +#include class SALOMEDSImpl_AttributeComment : public SALOMEDSImpl_GenericAttribute { private: - TCollection_ExtendedString myString; + std::string myString; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& 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 static SALOMEDSImpl_AttributeComment* Set(const DF_Label& L, const std::string& Val); +Standard_EXPORT void SetValue (const std::string& S); +Standard_EXPORT std::string 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 virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& 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 const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeComment() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeComment ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx index a47756deb..70a954f43 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.cxx @@ -27,16 +27,13 @@ using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeDrawable::GetID () +const std::string& SALOMEDSImpl_AttributeDrawable::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeDrawableID ("12837184-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeDrawableID ("12837184-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeDrawableID; } @@ -46,11 +43,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeDrawable::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeDrawable) SALOMEDSImpl_AttributeDrawable::Set (const TDF_Label& L, - const Standard_Integer value) +SALOMEDSImpl_AttributeDrawable* SALOMEDSImpl_AttributeDrawable::Set (const DF_Label& L, + const int value) { - Handle(SALOMEDSImpl_AttributeDrawable) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeDrawable::GetID(),A)) { + SALOMEDSImpl_AttributeDrawable* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeDrawable*)L.FindAttribute(SALOMEDSImpl_AttributeDrawable::GetID()))) { A = new SALOMEDSImpl_AttributeDrawable(); L.AddAttribute(A); } @@ -74,7 +71,7 @@ SALOMEDSImpl_AttributeDrawable::SALOMEDSImpl_AttributeDrawable() //function : SetDrawable //purpose : //======================================================================= -void SALOMEDSImpl_AttributeDrawable::SetDrawable(const Standard_Integer theValue) +void SALOMEDSImpl_AttributeDrawable::SetDrawable(const int theValue) { CheckLocked(); @@ -89,7 +86,7 @@ void SALOMEDSImpl_AttributeDrawable::SetDrawable(const Standard_Integer theValue //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID(); } //======================================================================= @@ -97,7 +94,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID( //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeDrawable::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeDrawable::NewEmpty () const { return new SALOMEDSImpl_AttributeDrawable(); } @@ -107,9 +104,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeDrawable::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeDrawable::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeDrawable::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeDrawable)::DownCast (with)->IsDrawable (); + myValue = dynamic_cast(with)->IsDrawable (); } //======================================================================= @@ -117,9 +114,8 @@ void SALOMEDSImpl_AttributeDrawable::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeDrawable::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeDrawable::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeDrawable)::DownCast (into)->SetDrawable (myValue); + dynamic_cast(into)->SetDrawable (myValue); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.hxx index 9e852a900..9fa1122e7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeDrawable.hxx @@ -24,44 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeDrawable_HeaderFile #define _SALOMEDSImpl_AttributeDrawable_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_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; +int 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 virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } +Standard_EXPORT virtual void Load(const std::string& 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 static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeDrawable* Set(const DF_Label& label,const int value) ; -Standard_EXPORT void SetDrawable(const Standard_Integer theValue); -Standard_EXPORT Standard_Integer IsDrawable() const { return myValue; } +Standard_EXPORT void SetDrawable(const int theValue); +Standard_EXPORT int 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 const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeDrawable() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeDrawable ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx index d0a2df1b2..a77d1e8c4 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.cxx @@ -27,16 +27,13 @@ using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeExpandable::GetID () +const std::string& SALOMEDSImpl_AttributeExpandable::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeExpandableID ("12837185-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeExpandableID ("12837185-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeExpandableID; } @@ -46,11 +43,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeExpandable::GetID () //function : Set //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeExpandable) SALOMEDSImpl_AttributeExpandable::Set (const TDF_Label& L, - const Standard_Integer value) +SALOMEDSImpl_AttributeExpandable* SALOMEDSImpl_AttributeExpandable::Set (const DF_Label& L, + const int value) { - Handle(SALOMEDSImpl_AttributeExpandable) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeExpandable::GetID(),A)) { + SALOMEDSImpl_AttributeExpandable* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeExpandable*)L.FindAttribute(SALOMEDSImpl_AttributeExpandable::GetID()))) { A = new SALOMEDSImpl_AttributeExpandable(); L.AddAttribute(A); } @@ -74,7 +71,7 @@ SALOMEDSImpl_AttributeExpandable::SALOMEDSImpl_AttributeExpandable() //function : SetExpandable //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExpandable::SetExpandable(const Standard_Integer theValue) +void SALOMEDSImpl_AttributeExpandable::SetExpandable(const int theValue) { CheckLocked(); @@ -88,7 +85,7 @@ void SALOMEDSImpl_AttributeExpandable::SetExpandable(const Standard_Integer theV //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeExpandable::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeExpandable::ID () const { return GetID(); } //======================================================================= @@ -96,7 +93,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeExpandable::ID () const { return GetI //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeExpandable::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeExpandable::NewEmpty () const { return new SALOMEDSImpl_AttributeExpandable(); } @@ -106,9 +103,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeExpandable::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExpandable::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeExpandable::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeExpandable)::DownCast (with)->IsExpandable (); + myValue = dynamic_cast(with)->IsExpandable (); } //======================================================================= @@ -116,9 +113,8 @@ void SALOMEDSImpl_AttributeExpandable::Restore(const Handle(TDF_Attribute)& with //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExpandable::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeExpandable::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeExpandable)::DownCast (into)->SetExpandable (myValue); + dynamic_cast(into)->SetExpandable (myValue); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.hxx index 48e7afd67..8b80e3b39 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExpandable.hxx @@ -24,43 +24,33 @@ #ifndef _SALOMEDSImpl_AttributeExpandable_HeaderFile #define _SALOMEDSImpl_AttributeExpandable_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #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; +int 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 virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } +Standard_EXPORT virtual void Load(const std::string& 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 static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeExpandable* Set(const DF_Label& label,const int value) ; Standard_EXPORT SALOMEDSImpl_AttributeExpandable(); -Standard_EXPORT void SetExpandable(const Standard_Integer value); +Standard_EXPORT void SetExpandable(const int 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 const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeExpandable() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeExpandable ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.cxx index f64099472..6bb5a1281 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.cxx @@ -25,16 +25,13 @@ 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 () +const std::string& SALOMEDSImpl_AttributeExternalFileDef::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE"); + static std::string SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE"); return SALOMEDSImpl_AttributeExternalFileDefID; } @@ -42,12 +39,12 @@ const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::GetID () //function : Set //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeExternalFileDef) -SALOMEDSImpl_AttributeExternalFileDef::Set (const TDF_Label& L, const TCollection_ExtendedString& S) +SALOMEDSImpl_AttributeExternalFileDef* +SALOMEDSImpl_AttributeExternalFileDef::Set (const DF_Label& L, const std::string& S) { - Handle(SALOMEDSImpl_AttributeExternalFileDef) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID(),A)) { + SALOMEDSImpl_AttributeExternalFileDef* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeExternalFileDef*)L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID()))) { A = new SALOMEDSImpl_AttributeExternalFileDef(); L.AddAttribute(A); } @@ -70,7 +67,7 @@ SALOMEDSImpl_AttributeExternalFileDef::SALOMEDSImpl_AttributeExternalFileDef() //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const std::string& S) { CheckLocked(); @@ -89,14 +86,14 @@ void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const TCollection_Extended //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const { return new SALOMEDSImpl_AttributeExternalFileDef(); } @@ -105,19 +102,18 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExternalFileDef::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeExternalFileDef::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= //function : Paste //purpose : //======================================================================= -void SALOMEDSImpl_AttributeExternalFileDef::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeExternalFileDef::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeExternalFileDef) anAttr = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(into); + SALOMEDSImpl_AttributeExternalFileDef* anAttr = dynamic_cast(into); anAttr->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.hxx index cec772be3..2222717bd 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeExternalFileDef.hxx @@ -21,43 +21,33 @@ #ifndef _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile #define _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #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; + std::string 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 static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeExternalFileDef* Set(const DF_Label& label, + const std::string& 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 void SetValue(const std::string& value); +Standard_EXPORT std::string Value() const { return myString; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeExternalFileDef() {} -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; } -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeExternalFileDef ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.cxx index 19661cbab..2b7a32ada 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.cxx @@ -25,17 +25,14 @@ 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 () +const std::string& SALOMEDSImpl_AttributeFileType::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeFileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340"); + static std::string SALOMEDSImpl_AttributeFileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340"); return SALOMEDSImpl_AttributeFileTypeID; } @@ -46,12 +43,12 @@ const Standard_GUID& SALOMEDSImpl_AttributeFileType::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeFileType) SALOMEDSImpl_AttributeFileType::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) +SALOMEDSImpl_AttributeFileType* SALOMEDSImpl_AttributeFileType::Set (const DF_Label& L, + const std::string& S) { - Handle(SALOMEDSImpl_AttributeFileType) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeFileType::GetID(),A)) { + SALOMEDSImpl_AttributeFileType* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeFileType*)L.FindAttribute(SALOMEDSImpl_AttributeFileType::GetID()))) { A = new SALOMEDSImpl_AttributeFileType(); L.AddAttribute(A); } @@ -74,7 +71,7 @@ SALOMEDSImpl_AttributeFileType::SALOMEDSImpl_AttributeFileType() //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeFileType::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributeFileType::SetValue (const std::string& S) { CheckLocked(); @@ -92,7 +89,7 @@ void SALOMEDSImpl_AttributeFileType::SetValue (const TCollection_ExtendedString& //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeFileType::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeFileType::ID () const { return GetID(); } //======================================================================= @@ -100,7 +97,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeFileType::ID () const { return GetID( //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeFileType::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeFileType::NewEmpty () const { return new SALOMEDSImpl_AttributeFileType(); } @@ -110,9 +107,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeFileType::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeFileType::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeFileType::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeFileType)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= @@ -120,9 +117,8 @@ void SALOMEDSImpl_AttributeFileType::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeFileType::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeFileType::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeFileType)::DownCast (into)->SetValue (myString); + dynamic_cast(into)->SetValue (myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.hxx index 54412c9cc..a4d61fe96 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFileType.hxx @@ -21,43 +21,33 @@ #ifndef _SALOMEDSImpl_AttributeFileType_HeaderFile #define _SALOMEDSImpl_AttributeFileType_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #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; + std::string 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 static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeFileType* Set(const DF_Label& label, + const std::string& 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 void SetValue(const std::string& value); +Standard_EXPORT std::string Value() const { return myString; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeFileType() {} -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; } -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeFileType ) }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.cxx index 4a9395e66..d0828013d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.cxx @@ -22,7 +22,6 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeFlags.hxx" -#include using namespace std; @@ -33,16 +32,13 @@ using namespace std; 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 () +const std::string& SALOMEDSImpl_AttributeFlags::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" ); + static std::string SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" ); return SALOMEDSImpl_AttributeFlagsID; } @@ -50,11 +46,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeFlags::GetID () //function : SALOMEDSImpl_AttributeFlags::Set //purpose : Set value of the attribute //======================================================================= -Handle(SALOMEDSImpl_AttributeFlags) SALOMEDSImpl_AttributeFlags::Set(const TDF_Label& L, - const Standard_Integer value ) +SALOMEDSImpl_AttributeFlags* SALOMEDSImpl_AttributeFlags::Set(const DF_Label& L, + const int value ) { - Handle(SALOMEDSImpl_AttributeFlags) A; - if ( !L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID(),A ) ) + SALOMEDSImpl_AttributeFlags* A = NULL; + if ( !(A=(SALOMEDSImpl_AttributeFlags*)L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID())) ) { A = new SALOMEDSImpl_AttributeFlags(); L.AddAttribute( A ); @@ -82,7 +78,7 @@ SALOMEDSImpl_AttributeFlags::~SALOMEDSImpl_AttributeFlags() //function : SALOMEDSImpl_AttributeFlags::ID //purpose : Get GUID of this attribute //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeFlags::ID () const +const std::string& SALOMEDSImpl_AttributeFlags::ID () const { return GetID(); } @@ -92,7 +88,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeFlags::ID () const //purpose : Create new empty attribute //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeFlags::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeFlags::NewEmpty () const { return new SALOMEDSImpl_AttributeFlags(); } @@ -101,9 +97,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeFlags::NewEmpty () const //function : SALOMEDSImpl_AttributeFlags::Restore //purpose : Assign given value to the attribute //======================================================================= -void SALOMEDSImpl_AttributeFlags::Restore( const Handle(TDF_Attribute)& with ) +void SALOMEDSImpl_AttributeFlags::Restore( DF_Attribute* with ) { - myValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast( with )->Get(); + myValue = dynamic_cast( with )->Get(); return; } @@ -111,17 +107,16 @@ void SALOMEDSImpl_AttributeFlags::Restore( const Handle(TDF_Attribute)& with ) //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 +void SALOMEDSImpl_AttributeFlags::Paste( DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeFlags)::DownCast( into )->Set( myValue ); + dynamic_cast( into )->Set( myValue ); } //======================================================================= //function : SALOMEDSImpl_AttributeFlags::Set //purpose : Set value //======================================================================= -void SALOMEDSImpl_AttributeFlags::Set( const Standard_Integer v ) +void SALOMEDSImpl_AttributeFlags::Set( const int v ) { Backup(); myValue=v; @@ -131,7 +126,7 @@ void SALOMEDSImpl_AttributeFlags::Set( const Standard_Integer v ) //function : SALOMEDSImpl_AttributeFlags::Get //purpose : GetValue //======================================================================= -Standard_Integer SALOMEDSImpl_AttributeFlags::Get() const +int SALOMEDSImpl_AttributeFlags::Get() const { return myValue; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.hxx index c28d1c694..773df8891 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.hxx @@ -24,24 +24,16 @@ #ifndef SALOMEDSImpl_AttributeFlags_HeaderFile #define SALOMEDSImpl_AttributeFlags_HeaderFile -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_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 @@ -49,25 +41,22 @@ class SALOMEDSImpl_AttributeFlags : public SALOMEDSImpl_GenericAttribute #endif { private: -Standard_Integer myValue; +int myValue; public: -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle(SALOMEDSImpl_AttributeFlags) Set(const TDF_Label&, const Standard_Integer ); +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeFlags* Set(const DF_Label&, const int theValue ); SALOMEDSImpl_AttributeFlags(); -Standard_EXPORT virtual ~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; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore( DF_Attribute* with ); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste( DF_Attribute* into); +Standard_EXPORT void Set( const int ); +Standard_EXPORT int Get() const; -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeFlags ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.cxx index ca0dc338f..b5f8c7c8d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.cxx @@ -22,9 +22,9 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeGraphic.hxx" -#include -#include -#include +#include "DF_Attribute.hxx" + +using namespace std; /* Class : SALOMEDSImpl_AttributeGraphic @@ -32,16 +32,13 @@ 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() +const std::string& SALOMEDSImpl_AttributeGraphic::GetID() { - static Standard_GUID SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" ); + static std::string SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" ); return SALOMEDSImpl_AttributeGraphicID; } @@ -66,17 +63,14 @@ 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 ) +void SALOMEDSImpl_AttributeGraphic::SetVisibility(const int theViewId, + const bool theValue ) { - if ( myVisibility.IsBound( theViewId ) && myVisibility( theViewId ) == theValue ) + if ( myVisibility.find( theViewId ) != myVisibility.end() && myVisibility[theViewId] == theValue ) return; Backup(); - if ( myVisibility.IsBound( theViewId ) ) - myVisibility.ChangeFind( theViewId ) = theValue ? 1 : 0; - else - myVisibility.Bind( theViewId, theValue ? 1 : 0 ); + myVisibility[ theViewId ] = theValue ? 1 : 0; } @@ -84,9 +78,15 @@ void SALOMEDSImpl_AttributeGraphic::SetVisibility(const Standard_Integer theView //function : Get //purpose : Get visibility of object in given view //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeGraphic::GetVisibility(const Standard_Integer theViewId ) const +bool SALOMEDSImpl_AttributeGraphic::GetVisibility(const int theViewId ) { - return myVisibility.IsBound( theViewId ) ? myVisibility( theViewId ) : false; + bool isVisible = false; + if(myVisibility.find( theViewId )!=myVisibility.end()) + isVisible = (bool)myVisibility[theViewId]; + else + isVisible = false; + + return isVisible; } @@ -94,7 +94,7 @@ Standard_Boolean SALOMEDSImpl_AttributeGraphic::GetVisibility(const Standard_Int //function : ID //purpose : Get GUID of this attribute //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeGraphic::ID () const +const std::string& SALOMEDSImpl_AttributeGraphic::ID () const { return GetID(); } @@ -104,7 +104,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeGraphic::ID () const //function : NewEmpty //purpose : Create new empty attribute //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeGraphic::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeGraphic::NewEmpty () const { return new SALOMEDSImpl_AttributeGraphic (); } @@ -113,7 +113,7 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeGraphic::NewEmpty () const //function : SetVisibility //purpose : Set visibility of object in all views //======================================================================= -void SALOMEDSImpl_AttributeGraphic::SetVisibility( const TColStd_DataMapOfIntegerInteger& theMap ) +void SALOMEDSImpl_AttributeGraphic::SetVisibility( const map& theMap ) { myVisibility = theMap; } @@ -122,7 +122,7 @@ void SALOMEDSImpl_AttributeGraphic::SetVisibility( const TColStd_DataMapOfIntege //function : SetVisibility //purpose : Get visibility of object in all views //======================================================================= -const TColStd_DataMapOfIntegerInteger& SALOMEDSImpl_AttributeGraphic::GetVisibility() +const map& SALOMEDSImpl_AttributeGraphic::GetVisibility() { return myVisibility; } @@ -131,12 +131,12 @@ const TColStd_DataMapOfIntegerInteger& SALOMEDSImpl_AttributeGraphic::GetVisibil //function : Restore //purpose : Restore value of attribute with value of theWith one //======================================================================= -void SALOMEDSImpl_AttributeGraphic::Restore( const Handle(TDF_Attribute)& theWith ) +void SALOMEDSImpl_AttributeGraphic::Restore( DF_Attribute* theWith ) { - Handle(SALOMEDSImpl_AttributeGraphic) anAttr = - Handle(SALOMEDSImpl_AttributeGraphic)::DownCast( theWith ); + SALOMEDSImpl_AttributeGraphic* anAttr = + dynamic_cast( theWith ); - if ( !anAttr.IsNull() ) + if ( anAttr ) SetVisibility( anAttr->GetVisibility() ); } @@ -144,37 +144,12 @@ void SALOMEDSImpl_AttributeGraphic::Restore( const Handle(TDF_Attribute)& theWit //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 +void SALOMEDSImpl_AttributeGraphic::Paste( DF_Attribute* theInto) { - Handle(SALOMEDSImpl_AttributeGraphic) anAttr = - Handle(SALOMEDSImpl_AttributeGraphic)::DownCast( theInto ); + SALOMEDSImpl_AttributeGraphic* anAttr = + dynamic_cast( theInto ); - if ( !anAttr.IsNull() ) + if ( anAttr ) 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; -} - diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.hxx index 8d5c2e96d..69801875a 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeGraphic.hxx @@ -24,15 +24,11 @@ #ifndef SALOMEDSImpl_AttributeGraphic_HeaderFile #define SALOMEDSImpl_AttributeGraphic_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); +#include /* Class : SALOMEDSImpl_AttributeGraphic @@ -40,10 +36,6 @@ class Handle(TDF_RelocationTable); 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 @@ -55,27 +47,22 @@ public: Standard_EXPORT SALOMEDSImpl_AttributeGraphic(); Standard_EXPORT ~SALOMEDSImpl_AttributeGraphic(); -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& 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 int, const bool ); +Standard_EXPORT bool GetVisibility( const int ); +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore( DF_Attribute* theWith ); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste( DF_Attribute* theInto); -Standard_EXPORT void SetVisibility( const TColStd_DataMapOfIntegerInteger& ); +Standard_EXPORT void SetVisibility( const std::map& ); -Standard_EXPORT const TColStd_DataMapOfIntegerInteger& GetVisibility(); +Standard_EXPORT const std::map& GetVisibility(); private: - TColStd_DataMapOfIntegerInteger myVisibility; + std::map myVisibility; -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeGraphic ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx index c77587f5d..b8c88df49 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx @@ -22,26 +22,20 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeIOR.hxx" -#include #include "SALOMEDSImpl_Study.hxx" -#include #ifndef WNT using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute ) - - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID () +const std::string& SALOMEDSImpl_AttributeIOR::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03"); + static std::string SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03"); return SALOMEDSImpl_AttributeIORID; } @@ -52,11 +46,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) +SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L, + const std::string& S) { - Handle(SALOMEDSImpl_AttributeIOR) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),A)) { + SALOMEDSImpl_AttributeIOR* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeIOR*)L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { A = new SALOMEDSImpl_AttributeIOR(); L.AddAttribute(A); } @@ -70,27 +64,23 @@ Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Labe //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeIOR::SetValue(const TCollection_ExtendedString& theValue) +void SALOMEDSImpl_AttributeIOR::SetValue(const std::string& theValue) { CheckLocked(); - Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(Label()); - aStudy->AddCreatedPostponed(theValue); - aStudy->AddPostponed(theValue); + SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(Label()); 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 +std::string SALOMEDSImpl_AttributeIOR::Value() const { return myString; } @@ -109,7 +99,7 @@ SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR() //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); } //======================================================================= @@ -117,7 +107,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); } //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeIOR::NewEmpty () const { return new SALOMEDSImpl_AttributeIOR(); } @@ -127,9 +117,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeIOR::Restore( DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeIOR)::DownCast (with)->Value(); + myString = dynamic_cast(with)->Value(); return; } @@ -138,9 +128,8 @@ void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeIOR::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeIOR::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeIOR)::DownCast (into)->SetValue(myString); + dynamic_cast(into)->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx index 1681775cf..eb0be83c5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx @@ -24,41 +24,31 @@ #ifndef _SALOMEDSImpl_AttributeIOR_HeaderFile #define _SALOMEDSImpl_AttributeIOR_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_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; + std::string 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 static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeIOR* Set(const DF_Label& label, + const std::string& IOR); 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 const std::string& ID() const; +Standard_EXPORT void SetValue(const std::string& theValue); +Standard_EXPORT std::string Value() const ; +Standard_EXPORT void Restore(DF_Attribute* with); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeIOR() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeIOR ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.cxx index c95a4d3cb..ea1058ff9 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.cxx @@ -27,24 +27,22 @@ using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute ) - +#include //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeInteger::GetID () +const std::string& SALOMEDSImpl_AttributeInteger::GetID () { - static Standard_GUID IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018"); + static std::string IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018"); return IntegerID; } -Handle(SALOMEDSImpl_AttributeInteger) SALOMEDSImpl_AttributeInteger::Set (const TDF_Label& L, Standard_Integer Val) +SALOMEDSImpl_AttributeInteger* SALOMEDSImpl_AttributeInteger::Set (const DF_Label& L, int Val) { - Handle(SALOMEDSImpl_AttributeInteger) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), A)) { + SALOMEDSImpl_AttributeInteger* A = NULL; + if (!(A = (SALOMEDSImpl_AttributeInteger*)L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) { A = new SALOMEDSImpl_AttributeInteger(); L.AddAttribute(A); } @@ -53,11 +51,20 @@ Handle(SALOMEDSImpl_AttributeInteger) SALOMEDSImpl_AttributeInteger::Set (const return A; } +//======================================================================= +//function : Value +//purpose : +//======================================================================= +int SALOMEDSImpl_AttributeInteger::Value() const +{ + return myValue; +} + //======================================================================= //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeInteger::SetValue(const Standard_Integer v) +void SALOMEDSImpl_AttributeInteger::SetValue(const int v) { if(myValue == v) return; @@ -71,14 +78,14 @@ void SALOMEDSImpl_AttributeInteger::SetValue(const Standard_Integer v) //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeInteger::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeInteger::NewEmpty () const { return new SALOMEDSImpl_AttributeInteger(); } @@ -87,17 +94,36 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeInteger::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeInteger::Restore(const Handle(TDF_Attribute)& With) +void SALOMEDSImpl_AttributeInteger::Restore(DF_Attribute* With) { - myValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast (With)->Value(); + myValue = dynamic_cast(With)->Value(); } //======================================================================= //function : Paste //purpose : //======================================================================= -void SALOMEDSImpl_AttributeInteger::Paste (const Handle(TDF_Attribute)& Into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeInteger::Paste (DF_Attribute* Into) { - Handle(SALOMEDSImpl_AttributeInteger)::DownCast(Into)->SetValue(myValue); + dynamic_cast(Into)->SetValue(myValue); } + +//======================================================================= +//function : Save +//purpose : +//======================================================================= +string SALOMEDSImpl_AttributeInteger::Save() +{ + char buffer[128]; + sprintf(buffer, "%d", myValue); + return string(buffer); +} + +//======================================================================= +//function : Load +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeInteger::Load(const string& theValue) +{ + myValue = atoi(theValue.c_str()); +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.hxx index bcc84fadd..94751adfa 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeInteger.hxx @@ -24,44 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeInteger_HeaderFile #define _SALOMEDSImpl_AttributeInteger_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_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; +int myValue; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& 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 static SALOMEDSImpl_AttributeInteger* Set (const DF_Label& L, int Val); +Standard_EXPORT void SetValue(const int theVal); +Standard_EXPORT int Value() const; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string& theValue); + +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeInteger() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeInteger ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.cxx index 15d80e4c9..7ee3b2302 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.cxx @@ -23,21 +23,17 @@ #include "SALOMEDSImpl_AttributeLocalID.hxx" -#include 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 () +const std::string& SALOMEDSImpl_AttributeLocalID::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeLocalID ("12837196-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeLocalID ("12837196-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeLocalID; } @@ -48,11 +44,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeLocalID::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeLocalID) SALOMEDSImpl_AttributeLocalID::Set (const TDF_Label& L, - const Standard_Integer value) +SALOMEDSImpl_AttributeLocalID* SALOMEDSImpl_AttributeLocalID::Set (const DF_Label& L, + const int value) { - Handle(SALOMEDSImpl_AttributeLocalID) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(),A)) { + SALOMEDSImpl_AttributeLocalID* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeLocalID*)L.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) { A = new SALOMEDSImpl_AttributeLocalID(); L.AddAttribute(A); } @@ -76,7 +72,7 @@ SALOMEDSImpl_AttributeLocalID::SALOMEDSImpl_AttributeLocalID() //function : Set //purpose : //======================================================================= -void SALOMEDSImpl_AttributeLocalID::SetValue(const Standard_Integer theValue) +void SALOMEDSImpl_AttributeLocalID::SetValue(const int theValue) { CheckLocked(); @@ -93,7 +89,7 @@ void SALOMEDSImpl_AttributeLocalID::SetValue(const Standard_Integer theValue) //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID(); } //======================================================================= @@ -101,7 +97,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID() //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeLocalID::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeLocalID::NewEmpty () const { return new SALOMEDSImpl_AttributeLocalID(); } @@ -111,9 +107,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeLocalID::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeLocalID::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeLocalID::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (with)->Value(); + myValue = dynamic_cast(with)->Value(); } //======================================================================= @@ -121,9 +117,27 @@ void SALOMEDSImpl_AttributeLocalID::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeLocalID::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeLocalID::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (into)->SetValue(myValue); + dynamic_cast(into)->SetValue(myValue); +} + +//======================================================================= +//function : Save +//purpose : +//======================================================================= +string SALOMEDSImpl_AttributeLocalID::Save() +{ + char buffer[128]; + sprintf(buffer, "%d", myValue); + return string(buffer); } +//======================================================================= +//function : Load +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeLocalID::Load(const string& theValue) +{ + myValue = atoi(theValue.c_str()); +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.hxx index 7d1dca361..2654146b4 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.hxx @@ -24,44 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeLocalID_HeaderFile #define _SALOMEDSImpl_AttributeLocalID_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_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; +int 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 virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string& theValue); -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 static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeLocalID* Set(const DF_Label& label,const int value) ; +Standard_EXPORT void SetValue(const int value); +Standard_EXPORT int 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 const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute*); Standard_EXPORT ~SALOMEDSImpl_AttributeLocalID() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeLocalID ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.cxx index e8b949a65..cd3546a01 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.cxx @@ -26,24 +26,21 @@ 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 () +const std::string& SALOMEDSImpl_AttributeName::GetID () { - static Standard_GUID NameID ("8650000D-63A0-4651-B621-CC95C9308598"); + static std::string NameID ("8650000D-63A0-4651-B621-CC95C9308598"); return NameID; } -Handle(SALOMEDSImpl_AttributeName) SALOMEDSImpl_AttributeName::Set (const TDF_Label& L, - const TCollection_ExtendedString& Val) +SALOMEDSImpl_AttributeName* SALOMEDSImpl_AttributeName::Set (const DF_Label& L, + const std::string& Val) { - Handle(SALOMEDSImpl_AttributeName) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), A)) { + SALOMEDSImpl_AttributeName* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeName*)L.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { A = new SALOMEDSImpl_AttributeName(); L.AddAttribute(A); } @@ -56,7 +53,7 @@ Handle(SALOMEDSImpl_AttributeName) SALOMEDSImpl_AttributeName::Set (const TDF_La //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeName::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributeName::SetValue (const std::string& S) { CheckLocked(); @@ -74,13 +71,13 @@ void SALOMEDSImpl_AttributeName::SetValue (const TCollection_ExtendedString& S) //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeName::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeName::ID () const { return GetID(); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeName::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeName::NewEmpty () const { return new SALOMEDSImpl_AttributeName(); } @@ -89,9 +86,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeName::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeName::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeName::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeName)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= @@ -99,8 +96,7 @@ void SALOMEDSImpl_AttributeName::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeName::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeName::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeName)::DownCast (into)->SetValue(myString); + dynamic_cast(into)->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.hxx index 8d767cc6a..2bb858a68 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeName.hxx @@ -24,48 +24,36 @@ #ifndef _SALOMEDSImpl_AttributeName_HeaderFile #define _SALOMEDSImpl_AttributeName_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_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; + std::string myString; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& 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 static SALOMEDSImpl_AttributeName* Set (const DF_Label& L, const std::string& Val); +Standard_EXPORT void SetValue(const std::string& theVal); +Standard_EXPORT std::string 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 virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& 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 const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeName() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeName ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.cxx index 8c0722eac..de77ffac9 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.cxx @@ -23,21 +23,17 @@ #include "SALOMEDSImpl_AttributeOpened.hxx" -#include 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 () +const std::string& SALOMEDSImpl_AttributeOpened::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeOpenedID ("12837186-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeOpenedID ("12837186-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeOpenedID; } @@ -48,11 +44,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeOpened::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeOpened) SALOMEDSImpl_AttributeOpened::Set (const TDF_Label& L, - const Standard_Integer value) +SALOMEDSImpl_AttributeOpened* SALOMEDSImpl_AttributeOpened::Set (const DF_Label& L, + const int value) { - Handle(SALOMEDSImpl_AttributeOpened) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeOpened::GetID(),A)) { + SALOMEDSImpl_AttributeOpened* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeOpened*)L.FindAttribute(SALOMEDSImpl_AttributeOpened::GetID()))) { A = new SALOMEDSImpl_AttributeOpened(); L.AddAttribute(A); } @@ -76,7 +72,7 @@ SALOMEDSImpl_AttributeOpened::SALOMEDSImpl_AttributeOpened() //function : SetOpened //purpose : //======================================================================= -void SALOMEDSImpl_AttributeOpened::SetOpened(const Standard_Integer theValue) +void SALOMEDSImpl_AttributeOpened::SetOpened(const int theValue) { Backup(); @@ -88,7 +84,7 @@ void SALOMEDSImpl_AttributeOpened::SetOpened(const Standard_Integer theValue) //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); } //======================================================================= @@ -96,7 +92,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeOpened::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeOpened::NewEmpty () const { return new SALOMEDSImpl_AttributeOpened(); } @@ -106,9 +102,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeOpened::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeOpened::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeOpened::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeOpened)::DownCast (with)->IsOpened (); + myValue = dynamic_cast(with)->IsOpened (); } //======================================================================= @@ -116,9 +112,8 @@ void SALOMEDSImpl_AttributeOpened::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeOpened::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeOpened::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeOpened)::DownCast (into)->SetOpened (myValue); + dynamic_cast(into)->SetOpened (myValue); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.hxx index b684e4310..8efd33901 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeOpened.hxx @@ -24,42 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeOpened_HeaderFile #define _SALOMEDSImpl_AttributeOpened_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_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; +int 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 virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } +Standard_EXPORT virtual void Load(const std::string& 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 static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeOpened* Set(const DF_Label& label,const int value) ; Standard_EXPORT SALOMEDSImpl_AttributeOpened(); -Standard_EXPORT void SetOpened(const Standard_Integer value); +Standard_EXPORT void SetOpened(const int 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 const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeOpened() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeOpened ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx index 820643d35..121edf8af 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx @@ -23,7 +23,6 @@ #include "SALOMEDSImpl_AttributeParameter.hxx" -#include #include #include @@ -33,10 +32,6 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute ) - - // Purpose: Each character in the string is replaced by 3 characters: '%' and hex number // of the character (2 characters) string convertString(const string& S) @@ -86,9 +81,9 @@ string restoreString(const string& S) * Purpose : Returns GUID of the attribute */ //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeParameter::GetID () +const std::string& SALOMEDSImpl_AttributeParameter::GetID () { - static Standard_GUID ParemeterID ("BA75F3A1-E40B-46b8-8D24-B1D3C3BB1A8C"); + static std::string ParemeterID ("BA75F3A1-E40B-46b8-8D24-B1D3C3BB1A8C"); return ParemeterID; } @@ -98,10 +93,10 @@ const Standard_GUID& SALOMEDSImpl_AttributeParameter::GetID () * Purpose : Adds an attribute to the label */ //======================================================================= -Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::Set (const TDF_Label& L) +SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_AttributeParameter::Set (const DF_Label& L) { - Handle(SALOMEDSImpl_AttributeParameter) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID(), A)) { + SALOMEDSImpl_AttributeParameter* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeParameter*)L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) { A = new SALOMEDSImpl_AttributeParameter(); L.AddAttribute(A); } @@ -136,7 +131,7 @@ void SALOMEDSImpl_AttributeParameter::SetInt(const string& theID, const int& the //======================================================================= int SALOMEDSImpl_AttributeParameter::GetInt(const string& theID) { - if(!IsSet(theID, PT_INTEGER)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_INTEGER)) throw DFexception("Invalid ID"); return _ints[theID]; } @@ -167,7 +162,7 @@ void SALOMEDSImpl_AttributeParameter::SetReal(const string& theID, const double& //======================================================================= double SALOMEDSImpl_AttributeParameter::GetReal(const string& theID) { - if(!IsSet(theID, PT_REAL)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_REAL)) throw DFexception("Invalid ID"); return _reals[theID]; } @@ -198,7 +193,7 @@ void SALOMEDSImpl_AttributeParameter::SetString(const string& theID, const strin //======================================================================= string SALOMEDSImpl_AttributeParameter::GetString(const string& theID) { - if(!IsSet(theID, PT_STRING)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_STRING)) throw DFexception("Invalid ID"); return _strings[theID]; } @@ -229,7 +224,7 @@ void SALOMEDSImpl_AttributeParameter::SetBool(const string& theID, const bool& t //======================================================================= bool SALOMEDSImpl_AttributeParameter::GetBool(const string& theID) { - if(!IsSet(theID, PT_BOOLEAN)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_BOOLEAN)) throw DFexception("Invalid ID"); return _bools[theID]; } @@ -260,7 +255,7 @@ void SALOMEDSImpl_AttributeParameter::SetRealArray(const string& theID, const ve //======================================================================= vector SALOMEDSImpl_AttributeParameter::GetRealArray(const string& theID) { - if(!IsSet(theID, PT_REALARRAY)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_REALARRAY)) throw DFexception("Invalid ID"); return _realarrays[theID]; } @@ -292,7 +287,7 @@ void SALOMEDSImpl_AttributeParameter::SetIntArray(const string& theID, const vec //======================================================================= vector SALOMEDSImpl_AttributeParameter::GetIntArray(const string& theID) { - if(!IsSet(theID, PT_INTARRAY)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_INTARRAY)) throw DFexception("Invalid ID"); return _intarrays[theID]; } @@ -324,7 +319,7 @@ void SALOMEDSImpl_AttributeParameter::SetStrArray(const string& theID, const vec //======================================================================= vector SALOMEDSImpl_AttributeParameter::GetStrArray(const string& theID) { - if(!IsSet(theID, PT_STRARRAY)) Standard_Failure::Raise("Invalid ID"); + if(!IsSet(theID, PT_STRARRAY)) throw DFexception("Invalid ID"); return _strarrays[theID]; } @@ -427,15 +422,15 @@ bool SALOMEDSImpl_AttributeParameter::RemoveID(const string& theID, const Parame * Purpose : Returns a father attribute for this attribute */ //======================================================================= -Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::GetFather() +SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_AttributeParameter::GetFather() { - Handle(SALOMEDSImpl_AttributeParameter) aFather; - TDF_Label L = Label(); + SALOMEDSImpl_AttributeParameter* aFather; + DF_Label L = Label(); if(L.IsRoot()) return aFather; while(!L.IsRoot()) { L = L.Father(); - if(L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID(), aFather)) break; + if((aFather=(SALOMEDSImpl_AttributeParameter*)L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) break; } return aFather; @@ -449,7 +444,7 @@ Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::GetFath //======================================================================= bool SALOMEDSImpl_AttributeParameter::HasFather() { - TDF_Label L = Label(); + DF_Label L = Label(); if(L.IsRoot()) return false; while(!L.IsRoot()) { L = L.Father(); @@ -572,10 +567,10 @@ vector SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types the * Purpose : Rteurns an GUID of the attribute */ //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeParameter::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeParameter::ID () const { return GetID(); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributeParameter::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeParameter::NewEmpty () const { return new SALOMEDSImpl_AttributeParameter(); } @@ -586,9 +581,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeParameter::NewEmpty () const * Purpose : Restors the content of the attribute from another */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeParameter::Restore(DF_Attribute* with) { - Handle(SALOMEDSImpl_AttributeParameter) A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast (with); + SALOMEDSImpl_AttributeParameter* A = dynamic_cast(with); _ints.clear(); _reals.clear(); _bools.clear(); @@ -619,8 +614,7 @@ void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with) * Purpose : Pastes the content of attribute to another */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeParameter::Paste (DF_Attribute* into) { into->Restore(this); } @@ -631,7 +625,7 @@ void SALOMEDSImpl_AttributeParameter::Paste (const Handle(TDF_Attribute)& into, * Purpose : Saves a content of the attribute as a string */ //======================================================================= -TCollection_AsciiString SALOMEDSImpl_AttributeParameter::Save() +string SALOMEDSImpl_AttributeParameter::Save() { ostrstream buffer; char *tmpBuffer = new char[255]; @@ -692,7 +686,7 @@ TCollection_AsciiString SALOMEDSImpl_AttributeParameter::Save() delete tmpBuffer; - TCollection_AsciiString AS((char*)buffer.rdbuf()->str()); + string AS((char*)buffer.rdbuf()->str()); return AS; } @@ -703,7 +697,7 @@ TCollection_AsciiString SALOMEDSImpl_AttributeParameter::Save() * Purpose : Restores the attribute from the string */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::Load(const TCollection_AsciiString& theValue) +void SALOMEDSImpl_AttributeParameter::Load(const string& theValue) { Backup(); @@ -714,7 +708,7 @@ void SALOMEDSImpl_AttributeParameter::Load(const TCollection_AsciiString& theVal _realarrays.clear(); _intarrays.clear(); - istrstream buffer(theValue.ToCString(), strlen(theValue.ToCString())); + istrstream buffer(theValue.c_str(), theValue.size()); int size, val, ival; double val2; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx index 8ac7116fc..ecbc14ec2 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx @@ -24,24 +24,14 @@ #ifndef _SALOMEDSImpl_AttributeParameter_HeaderFile #define _SALOMEDSImpl_AttributeParameter_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" #include #include #include -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute ) - enum Parameter_Types {PT_INTEGER, PT_REAL, PT_BOOLEAN, PT_STRING, PT_REALARRAY, PT_INTARRAY, PT_STRARRAY}; /*! @@ -54,19 +44,19 @@ class SALOMEDSImpl_AttributeParameter : public SALOMEDSImpl_GenericAttribute private: - std::map _ints; - std::map _reals; - std::map _strings; - std::map _bools; - std::map< std::string, vector > _realarrays; - std::map< std::string, vector > _intarrays; - std::map< std::string, vector > _strarrays; + std::map _ints; + std::map _reals; + std::map _strings; + std::map _bools; + std::map< std::string, std::vector > _realarrays; + std::map< std::string, std::vector > _intarrays; + std::map< std::string, std::vector > _strarrays; public: - Standard_EXPORT static const Standard_GUID& GetID() ; + Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {} - Standard_EXPORT static Handle(SALOMEDSImpl_AttributeParameter) Set (const TDF_Label& L); + Standard_EXPORT static SALOMEDSImpl_AttributeParameter* Set (const DF_Label& L); Standard_EXPORT void SetInt(const std::string& theID, const int& theValue); @@ -94,7 +84,7 @@ public: Standard_EXPORT bool RemoveID(const std::string& theID, const Parameter_Types theType); - Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetFather(); + Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetFather(); Standard_EXPORT bool HasFather(); Standard_EXPORT bool IsRoot(); @@ -102,18 +92,16 @@ public: Standard_EXPORT void Clear(); - Standard_EXPORT virtual TCollection_AsciiString Save(); - Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue); + Standard_EXPORT virtual std::string Save(); + Standard_EXPORT virtual void Load(const std::string& 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 const std::string& ID() const; + Standard_EXPORT void Restore(DF_Attribute* with) ; + Standard_EXPORT DF_Attribute* NewEmpty() const; + Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeParameter() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeParameter ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.cxx index 5ea1ce748..e60d05d22 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.cxx @@ -23,21 +23,17 @@ #include "SALOMEDSImpl_AttributePersistentRef.hxx" -#include 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 () +const std::string& SALOMEDSImpl_AttributePersistentRef::GetID () { - static Standard_GUID SALOMEDSImpl_AttributePersistentRefID ("92888E06-7074-11d5-A690-0800369C8A03"); + static std::string SALOMEDSImpl_AttributePersistentRefID ("92888E06-7074-11d5-A690-0800369C8A03"); return SALOMEDSImpl_AttributePersistentRefID; } @@ -48,11 +44,11 @@ const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributePersistentRef) SALOMEDSImpl_AttributePersistentRef::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) +SALOMEDSImpl_AttributePersistentRef* SALOMEDSImpl_AttributePersistentRef::Set (const DF_Label& L, + const std::string& S) { - Handle(SALOMEDSImpl_AttributePersistentRef) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),A)) { + SALOMEDSImpl_AttributePersistentRef* A = NULL; + if (!(A=(SALOMEDSImpl_AttributePersistentRef*)L.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) { A = new SALOMEDSImpl_AttributePersistentRef(); L.AddAttribute(A); } @@ -76,14 +72,14 @@ SALOMEDSImpl_AttributePersistentRef::SALOMEDSImpl_AttributePersistentRef() //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributePersistentRef::ID () const { return GetID(); } //======================================================================= //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributePersistentRef::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributePersistentRef::SetValue (const std::string& S) { CheckLocked(); @@ -101,7 +97,7 @@ void SALOMEDSImpl_AttributePersistentRef::SetValue (const TCollection_ExtendedSt //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributePersistentRef::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributePersistentRef::NewEmpty () const { return new SALOMEDSImpl_AttributePersistentRef(); } @@ -111,9 +107,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributePersistentRef::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributePersistentRef::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributePersistentRef::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= @@ -121,9 +117,8 @@ void SALOMEDSImpl_AttributePersistentRef::Restore(const Handle(TDF_Attribute)& w //purpose : //======================================================================= -void SALOMEDSImpl_AttributePersistentRef::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributePersistentRef::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast (into)->SetValue(myString); + dynamic_cast(into)->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.hxx index 9a20377d8..fa95a619f 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePersistentRef.hxx @@ -24,44 +24,34 @@ #ifndef _SALOMEDSImpl_AttributePersistentRef_HeaderFile #define _SALOMEDSImpl_AttributePersistentRef_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_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; + std::string myString; public: -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& 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 static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributePersistentRef* Set(const DF_Label& label, + const std::string& value) ; 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 const std::string& ID() const; +Standard_EXPORT void SetValue(const std::string& value); +Standard_EXPORT std::string Value() const { return myString; } +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributePersistentRef() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePersistentRef ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.cxx index 665983445..300bd6bd5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.cxx @@ -22,22 +22,17 @@ // Module : SALOME #include "SALOMEDSImpl_AttributePixMap.hxx" -#include -#include 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 () +const std::string& SALOMEDSImpl_AttributePixMap::GetID () { - static Standard_GUID SALOMEDSImpl_AttributePixMapID ("12837187-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributePixMapID ("12837187-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributePixMapID; } @@ -48,11 +43,11 @@ const Standard_GUID& SALOMEDSImpl_AttributePixMap::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributePixMap) SALOMEDSImpl_AttributePixMap::Set (const TDF_Label& L, - const TCollection_ExtendedString& S) +SALOMEDSImpl_AttributePixMap* SALOMEDSImpl_AttributePixMap::Set (const DF_Label& L, + const std::string& S) { - Handle(SALOMEDSImpl_AttributePixMap) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributePixMap::GetID(),A)) { + SALOMEDSImpl_AttributePixMap* A = NULL; + if (!(A=(SALOMEDSImpl_AttributePixMap*)L.FindAttribute(SALOMEDSImpl_AttributePixMap::GetID()))) { A = new SALOMEDSImpl_AttributePixMap(); L.AddAttribute(A); } @@ -76,7 +71,7 @@ SALOMEDSImpl_AttributePixMap::SALOMEDSImpl_AttributePixMap() //function : SetPixMap //purpose : //======================================================================= -void SALOMEDSImpl_AttributePixMap::SetPixMap (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributePixMap::SetPixMap (const std::string& S) { CheckLocked(); @@ -94,7 +89,7 @@ void SALOMEDSImpl_AttributePixMap::SetPixMap (const TCollection_ExtendedString& //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); } //======================================================================= @@ -102,7 +97,7 @@ const Standard_GUID& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributePixMap::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributePixMap::NewEmpty () const { return new SALOMEDSImpl_AttributePixMap(); } @@ -112,9 +107,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributePixMap::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributePixMap::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributePixMap::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributePixMap)::DownCast (with)->GetPixMap (); + myString = dynamic_cast(with)->GetPixMap (); } //======================================================================= @@ -122,9 +117,8 @@ void SALOMEDSImpl_AttributePixMap::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributePixMap::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributePixMap::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributePixMap)::DownCast (into)->SetPixMap (myString); + dynamic_cast(into)->SetPixMap (myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.hxx index f4b38c9ef..ac0fcbd33 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePixMap.hxx @@ -24,47 +24,34 @@ #ifndef _SALOMEDSImpl_AttributePixMap_HeaderFile #define _SALOMEDSImpl_AttributePixMap_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_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; + std::string myString; public: -Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } -Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } +Standard_EXPORT virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& 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 static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributePixMap* Set(const DF_Label& label, + const std::string& 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 const std::string& ID() const; +Standard_EXPORT void SetPixMap(const std::string& value); +Standard_EXPORT std::string GetPixMap() const { return myString; } +Standard_EXPORT bool HasPixMap() const { return (myString != "None"); } +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributePixMap() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePixMap ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx index 7267b3dfa..cfd38f459 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx @@ -22,36 +22,32 @@ // Module : SALOME #include "SALOMEDSImpl_AttributePythonObject.hxx" -#include -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute ) - -const Standard_GUID& SALOMEDSImpl_AttributePythonObject::GetID() +const std::string& SALOMEDSImpl_AttributePythonObject::GetID() { - static Standard_GUID SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributePythonObjectID; } -Handle(SALOMEDSImpl_AttributePythonObject) SALOMEDSImpl_AttributePythonObject::Set(const TDF_Label& label) +SALOMEDSImpl_AttributePythonObject* SALOMEDSImpl_AttributePythonObject::Set(const DF_Label& label) { - Handle(SALOMEDSImpl_AttributePythonObject) anAttr; - if (!label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID(),anAttr)) { - anAttr = new SALOMEDSImpl_AttributePythonObject(); - label.AddAttribute(anAttr); + SALOMEDSImpl_AttributePythonObject* A = NULL; + if (!(A = (SALOMEDSImpl_AttributePythonObject*)label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID()))) { + A = new SALOMEDSImpl_AttributePythonObject(); + label.AddAttribute(A); } - return anAttr; + return A; } SALOMEDSImpl_AttributePythonObject::SALOMEDSImpl_AttributePythonObject() :SALOMEDSImpl_GenericAttribute("AttributePythonObject") { + myIsScript = false; } -void SALOMEDSImpl_AttributePythonObject::SetObject(const TCollection_AsciiString& theSequence, +void SALOMEDSImpl_AttributePythonObject::SetObject(const string& theSequence, const bool theScript) { CheckLocked(); @@ -62,7 +58,7 @@ void SALOMEDSImpl_AttributePythonObject::SetObject(const TCollection_AsciiString SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::GetObject() const +string SALOMEDSImpl_AttributePythonObject::GetObject() const { return mySequence; } @@ -74,44 +70,43 @@ bool SALOMEDSImpl_AttributePythonObject::IsScript() const int SALOMEDSImpl_AttributePythonObject::GetLength() const { - return mySequence.Length(); + return mySequence.size(); } -const Standard_GUID& SALOMEDSImpl_AttributePythonObject::ID() const +const std::string& SALOMEDSImpl_AttributePythonObject::ID() const { return GetID(); } -void SALOMEDSImpl_AttributePythonObject::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributePythonObject::Restore(DF_Attribute* with) { - Handle(SALOMEDSImpl_AttributePythonObject) anObj = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(with); + SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast(with); SetObject(anObj->GetObject(),anObj->IsScript()); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributePythonObject::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributePythonObject::NewEmpty() const { return new SALOMEDSImpl_AttributePythonObject(); } -void SALOMEDSImpl_AttributePythonObject::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const +void SALOMEDSImpl_AttributePythonObject::Paste(DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributePythonObject) anObj = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(into); + SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast(into); anObj->SetObject(GetObject(),IsScript()); } -TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::Save() +string SALOMEDSImpl_AttributePythonObject::Save() { - TCollection_AsciiString aString = GetObject(); - TCollection_AsciiString aResult = IsScript()?'s':'n'; + string aString = GetObject(); + string aResult = IsScript()?"s":"n"; aResult += aString; return aResult; } -void SALOMEDSImpl_AttributePythonObject::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributePythonObject::Load(const string& value) { - char* aString = value.ToCString(); + char* aString = (char*)value.c_str(); SetObject(aString + 1, aString[0]=='s'); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.hxx index 84810f8f3..bda55e4fa 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.hxx @@ -24,20 +24,11 @@ #ifndef _SALOMEDSImpl_AttributePythonObject_HeaderFile #define _SALOMEDSImpl_AttributePythonObject_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #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 @@ -46,30 +37,27 @@ class SALOMEDSImpl_AttributePythonObject : public SALOMEDSImpl_GenericAttribute { public: -Standard_EXPORT virtual TCollection_AsciiString Save(); -Standard_EXPORT virtual void Load(const TCollection_AsciiString&); +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributePythonObject Set(const TDF_Label& label) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributePythonObject* Set(const DF_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 void SetObject(const std::string& theSequence, const bool theScript) ; +Standard_EXPORT std::string 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 const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributePythonObject() {} private: -TCollection_AsciiString mySequence; +std::string mySequence; bool myIsScript; -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePythonObject ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.cxx index d8bef6b58..644ee77b9 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.cxx @@ -25,23 +25,23 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute ) +#include + //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeReal::GetID () +const std::string& SALOMEDSImpl_AttributeReal::GetID () { - static Standard_GUID realID ("1D1992F0-56F4-46b4-8065-CDEA68061CAB"); + static std::string realID ("1D1992F0-56F4-46b4-8065-CDEA68061CAB"); return realID; } -Handle(SALOMEDSImpl_AttributeReal) SALOMEDSImpl_AttributeReal::Set (const TDF_Label& L, const Standard_Real Val) +SALOMEDSImpl_AttributeReal* SALOMEDSImpl_AttributeReal::Set (const DF_Label& L, const double& Val) { - Handle(SALOMEDSImpl_AttributeReal) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeReal::GetID(), A)) { + SALOMEDSImpl_AttributeReal* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeReal*)L.FindAttribute(SALOMEDSImpl_AttributeReal::GetID()))) { A = new SALOMEDSImpl_AttributeReal(); L.AddAttribute(A); } @@ -54,7 +54,7 @@ Handle(SALOMEDSImpl_AttributeReal) SALOMEDSImpl_AttributeReal::Set (const TDF_La //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReal::SetValue(const Standard_Real v) +void SALOMEDSImpl_AttributeReal::SetValue(const double& v) { CheckLocked(); @@ -70,7 +70,7 @@ void SALOMEDSImpl_AttributeReal::SetValue(const Standard_Real v) //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeReal::ID () const +const std::string& SALOMEDSImpl_AttributeReal::ID () const { return GetID(); } @@ -79,7 +79,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeReal::ID () const //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeReal::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeReal::NewEmpty () const { return new SALOMEDSImpl_AttributeReal(); } @@ -88,17 +88,36 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeReal::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReal::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeReal::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast (with)->Value (); + myValue = dynamic_cast(with)->Value (); } //======================================================================= //function : Paste //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReal::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeReal::Paste (DF_Attribute* into) +{ + dynamic_cast(into)->SetValue(myValue); +} + +//======================================================================= +//function : Save +//purpose : +//======================================================================= +string SALOMEDSImpl_AttributeReal::Save() +{ + char buffer[255]; + sprintf(buffer, "%.64e", myValue); + return string(buffer); +} + +//======================================================================= +//function : Load +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeReal::Load(const string& theValue) { - Handle(SALOMEDSImpl_AttributeReal)::DownCast (into)->SetValue(myValue); + myValue = atof(theValue.c_str()); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.hxx index 2a3d51a06..488f3bfe8 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.hxx @@ -24,44 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeReal_HeaderFile #define _SALOMEDSImpl_AttributeReal_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_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; + double myValue; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& 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 static SALOMEDSImpl_AttributeReal* Set (const DF_Label& L, const double& Val); +Standard_EXPORT void SetValue(const double& theVal); +Standard_EXPORT double Value() const { return myValue; } +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string& theValue); + +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeReal() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeReal ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.cxx index 54c8fe536..f267e0b93 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.cxx @@ -22,31 +22,24 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeReference.hxx" -#include -#include -#include 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 () +const std::string& SALOMEDSImpl_AttributeReference::GetID () { - static Standard_GUID refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86"); + static std::string refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86"); return refID; } -Handle(SALOMEDSImpl_AttributeReference) SALOMEDSImpl_AttributeReference::Set(const TDF_Label& theLabel, - const TDF_Label& theRefLabel) +SALOMEDSImpl_AttributeReference* SALOMEDSImpl_AttributeReference::Set(const DF_Label& theLabel, + const DF_Label& theRefLabel) { - Handle(SALOMEDSImpl_AttributeReference) A; - if (!theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), A)) { + SALOMEDSImpl_AttributeReference* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeReference*)theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { A = new SALOMEDSImpl_AttributeReference(); theLabel.AddAttribute(A); } @@ -59,7 +52,7 @@ Handle(SALOMEDSImpl_AttributeReference) SALOMEDSImpl_AttributeReference::Set(con //function : Set //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReference::Set(const TDF_Label& Origin) +void SALOMEDSImpl_AttributeReference::Set(const DF_Label& Origin) { CheckLocked(); @@ -75,28 +68,24 @@ void SALOMEDSImpl_AttributeReference::Set(const TDF_Label& Origin) //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); } -TCollection_AsciiString SALOMEDSImpl_AttributeReference::Save() +string SALOMEDSImpl_AttributeReference::Save() { - TCollection_AsciiString anEntry; - TDF_Tool::Entry(myLabel, anEntry); - return anEntry; + return myLabel.Entry(); } -void SALOMEDSImpl_AttributeReference::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeReference::Load(const string& value) { - TDF_Label aLabel; - TDF_Tool::Label(Label().Data(), value, aLabel); - myLabel = aLabel; + myLabel = DF_Label::Label(Label(), value, true); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeReference::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeReference::NewEmpty () const { return new SALOMEDSImpl_AttributeReference(); } @@ -106,9 +95,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeReference::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReference::Restore(const Handle(TDF_Attribute)& With) +void SALOMEDSImpl_AttributeReference::Restore(DF_Attribute* With) { - myLabel = Handle(SALOMEDSImpl_AttributeReference)::DownCast (With)->Get (); + myLabel = dynamic_cast(With)->Get (); } //======================================================================= @@ -116,12 +105,7 @@ void SALOMEDSImpl_AttributeReference::Restore(const Handle(TDF_Attribute)& With) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeReference::Paste (const Handle(TDF_Attribute)& Into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeReference::Paste (DF_Attribute* Into) { - TDF_Label tLab; - if (!myLabel.IsNull()) { - if (!RT->HasRelocation(myLabel,tLab)) tLab = myLabel; - } - Handle(SALOMEDSImpl_AttributeReference)::DownCast(Into)->Set(tLab); + dynamic_cast(Into)->Set(myLabel); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.hxx index 892fea708..4c69dee7b 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeReference.hxx @@ -24,46 +24,33 @@ #ifndef _SALOMEDSImpl_AttributeReference_HeaderFile #define _SALOMEDSImpl_AttributeReference_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #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; + DF_Label myLabel; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& 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 static SALOMEDSImpl_AttributeReference* Set(const DF_Label& theLabel, const DF_Label& theRefLabel); +Standard_EXPORT void Set(const DF_Label& theLabel); +Standard_EXPORT DF_Label Get() const { return myLabel; } +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string& 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 const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeReference() {} - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeReference ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx index 4e1bbc768..3b2e36ebe 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.cxx @@ -22,21 +22,17 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeSelectable.hxx" -#include 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 () +const std::string& SALOMEDSImpl_AttributeSelectable::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeSelectableID ("12837188-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeSelectableID ("12837188-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeSelectableID; } @@ -47,11 +43,11 @@ const Standard_GUID& SALOMEDSImpl_AttributeSelectable::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeSelectable) SALOMEDSImpl_AttributeSelectable::Set (const TDF_Label& L, - const Standard_Integer value) +SALOMEDSImpl_AttributeSelectable* SALOMEDSImpl_AttributeSelectable::Set (const DF_Label& L, + const int value) { - Handle(SALOMEDSImpl_AttributeSelectable) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeSelectable::GetID(),A)) { + SALOMEDSImpl_AttributeSelectable* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeSelectable*)L.FindAttribute(SALOMEDSImpl_AttributeSelectable::GetID()))) { A = new SALOMEDSImpl_AttributeSelectable(); L.AddAttribute(A); } @@ -75,7 +71,7 @@ SALOMEDSImpl_AttributeSelectable::SALOMEDSImpl_AttributeSelectable() //function : SetSelectable //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSelectable::SetSelectable(const Standard_Integer theValue) +void SALOMEDSImpl_AttributeSelectable::SetSelectable(const int theValue) { Backup(); @@ -87,7 +83,7 @@ void SALOMEDSImpl_AttributeSelectable::SetSelectable(const Standard_Integer theV //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeSelectable::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeSelectable::ID () const { return GetID(); } //======================================================================= @@ -95,7 +91,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeSelectable::ID () const { return GetI //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeSelectable::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeSelectable::NewEmpty () const { return new SALOMEDSImpl_AttributeSelectable(); } @@ -105,9 +101,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeSelectable::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSelectable::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeSelectable::Restore(DF_Attribute* with) { - myValue = Handle(SALOMEDSImpl_AttributeSelectable)::DownCast (with)->IsSelectable (); + myValue = dynamic_cast(with)->IsSelectable (); } //======================================================================= @@ -115,9 +111,8 @@ void SALOMEDSImpl_AttributeSelectable::Restore(const Handle(TDF_Attribute)& with //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSelectable::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeSelectable::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeSelectable)::DownCast (into)->SetSelectable (myValue); + dynamic_cast(into)->SetSelectable (myValue); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.hxx index 28fa2a2cb..dfdc71871 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSelectable.hxx @@ -24,45 +24,32 @@ #ifndef _SALOMEDSImpl_AttributeSelectable_HeaderFile #define _SALOMEDSImpl_AttributeSelectable_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #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; +int 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 virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; } +Standard_EXPORT virtual void Load(const std::string& 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 static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeSelectable* Set(const DF_Label& label,const int 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 void SetSelectable(const int value); +Standard_EXPORT int IsSelectable() const { return myValue; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeSelectable() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeDrawable ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx index 8519394a9..8a697a3da 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.cxx @@ -22,22 +22,17 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx" -#include 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 () +const std::string& SALOMEDSImpl_AttributeSequenceOfInteger::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeSequenceOfIntegerID ("12837182-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeSequenceOfIntegerID ("12837182-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeSequenceOfIntegerID; } @@ -48,10 +43,10 @@ const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeSequenceOfInteger) SALOMEDSImpl_AttributeSequenceOfInteger::Set (const TDF_Label& L) +SALOMEDSImpl_AttributeSequenceOfInteger* SALOMEDSImpl_AttributeSequenceOfInteger::Set (const DF_Label& L) { - Handle(SALOMEDSImpl_AttributeSequenceOfInteger) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfInteger::GetID(),A)) { + SALOMEDSImpl_AttributeSequenceOfInteger* A = NULL; + if (!(A = (SALOMEDSImpl_AttributeSequenceOfInteger*)L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfInteger::GetID()))) { A = new SALOMEDSImpl_AttributeSequenceOfInteger(); L.AddAttribute(A); } @@ -65,16 +60,14 @@ Handle(SALOMEDSImpl_AttributeSequenceOfInteger) SALOMEDSImpl_AttributeSequenceOf //======================================================================= SALOMEDSImpl_AttributeSequenceOfInteger::SALOMEDSImpl_AttributeSequenceOfInteger() :SALOMEDSImpl_GenericAttribute("AttributeSequenceOfInteger") -{ - myValue = new TColStd_HSequenceOfInteger(); -} +{} //======================================================================= //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { return GetID(); } //======================================================================= @@ -82,7 +75,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { retu //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const { return new SALOMEDSImpl_AttributeSequenceOfInteger(); } @@ -92,18 +85,12 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(DF_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; + SALOMEDSImpl_AttributeSequenceOfInteger* anSeq = dynamic_cast(with); + myValue.clear(); + for(int i = 0, len = anSeq->Length(); imyValue[i]); } //======================================================================= @@ -111,96 +98,97 @@ void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(const Handle(TDF_Attribute //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSequenceOfInteger::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const +void SALOMEDSImpl_AttributeSequenceOfInteger::Paste (DF_Attribute* into) { - if(!myValue.IsNull()) { - Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast (into)->Assign(myValue); - } + dynamic_cast(into)->Assign(myValue); } -void SALOMEDSImpl_AttributeSequenceOfInteger::Assign(const Handle(TColStd_HSequenceOfInteger)& other) +void SALOMEDSImpl_AttributeSequenceOfInteger::Assign(const vector& other) { CheckLocked(); Backup(); - if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger; - myValue->ChangeSequence() = other->Sequence(); + myValue = other; + 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) +void SALOMEDSImpl_AttributeSequenceOfInteger::ChangeValue(const int Index,const int Value) { CheckLocked(); Backup(); - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); - myValue->SetValue(Index, Value); + myValue[Index-1] = Value; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeSequenceOfInteger::Add(const Standard_Integer Value) +void SALOMEDSImpl_AttributeSequenceOfInteger::Add(const int Value) { CheckLocked(); Backup(); - myValue->Append(Value); + myValue.push_back(Value); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const Standard_Integer Index) +void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const int Index) { CheckLocked(); Backup(); - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); + + typedef vector::iterator VI; + int i = 1; + for(VI p = myValue.begin(); p!=myValue.end(); p++, i++) { + if(i == Index) { + myValue.erase(p); + break; + } + } - myValue->Remove(Index); - SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Length() +int SALOMEDSImpl_AttributeSequenceOfInteger::Length() { - return myValue->Length(); + return myValue.size(); } -Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Value(const Standard_Integer Index) +int SALOMEDSImpl_AttributeSequenceOfInteger::Value(const int Index) { - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); - return myValue->Value(Index); + return myValue[Index-1]; } -TCollection_AsciiString SALOMEDSImpl_AttributeSequenceOfInteger::Save() +string SALOMEDSImpl_AttributeSequenceOfInteger::Save() { - Standard_Integer aLength = Length(); + int aLength = Length(); char* aResult = new char[aLength * 25]; aResult[0] = 0; - Standard_Integer aPosition = 0; + int aPosition = 0; for (int i = 1; i <= aLength; i++) { sprintf(aResult + aPosition , "%d ", Value(i)); aPosition += strlen(aResult + aPosition); } - TCollection_AsciiString ret(aResult); + string ret(aResult); delete aResult; return ret; } -void SALOMEDSImpl_AttributeSequenceOfInteger::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeSequenceOfInteger::Load(const string& value) { - Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger; - - char* aCopy = value.ToCString(); + char* aCopy = (char*)value.c_str(); char* adr = strtok(aCopy, " "); while (adr) { int l = atol(adr); - CasCadeSeq->Append(l); + Add(l); adr = strtok(NULL, " "); } - Assign(CasCadeSeq); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.hxx index 574df6871..f1f935b4d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfInteger.hxx @@ -24,50 +24,38 @@ #ifndef _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile #define _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include +#include #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 virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSequenceOfInteger Set(const TDF_Label& label) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeSequenceOfInteger* Set(const DF_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 void Assign(const std::vector& other) ; +Standard_EXPORT void ChangeValue(const int Index,const int Value) ; +Standard_EXPORT void Add(const int value) ; +Standard_EXPORT int Value(const int Index) ; +Standard_EXPORT void Remove(const int Index) ; +Standard_EXPORT int Length() ; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeSequenceOfInteger() {} +Standard_EXPORT const std::vector& Array() { return myValue; } private: - -Handle_TColStd_HSequenceOfInteger myValue; - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeSequenceOfInteger ) - +std::vector myValue; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx index 3d78ec633..8b034c995 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.cxx @@ -22,21 +22,17 @@ // Module : SALOME #include "SALOMEDSImpl_AttributeSequenceOfReal.hxx" -#include 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 () +const std::string& SALOMEDSImpl_AttributeSequenceOfReal::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeSequenceOfRealID ("12837183-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeSequenceOfRealID ("12837183-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeSequenceOfRealID; } @@ -47,10 +43,10 @@ const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeSequenceOfReal) SALOMEDSImpl_AttributeSequenceOfReal::Set (const TDF_Label& L) +SALOMEDSImpl_AttributeSequenceOfReal* SALOMEDSImpl_AttributeSequenceOfReal::Set (const DF_Label& L) { - Handle(SALOMEDSImpl_AttributeSequenceOfReal) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfReal::GetID(),A)) { + SALOMEDSImpl_AttributeSequenceOfReal* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeSequenceOfReal*)L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfReal::GetID()))) { A = new SALOMEDSImpl_AttributeSequenceOfReal(); L.AddAttribute(A); } @@ -65,7 +61,7 @@ Handle(SALOMEDSImpl_AttributeSequenceOfReal) SALOMEDSImpl_AttributeSequenceOfRea SALOMEDSImpl_AttributeSequenceOfReal::SALOMEDSImpl_AttributeSequenceOfReal() :SALOMEDSImpl_GenericAttribute("AttributeSequenceOfReal") { - myValue = new TColStd_HSequenceOfReal(); + myValue.clear(); } //======================================================================= @@ -73,7 +69,7 @@ SALOMEDSImpl_AttributeSequenceOfReal::SALOMEDSImpl_AttributeSequenceOfReal() //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return GetID(); } //======================================================================= @@ -81,7 +77,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const { return new SALOMEDSImpl_AttributeSequenceOfReal(); } @@ -91,17 +87,12 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSequenceOfReal::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeSequenceOfReal::Restore(DF_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(); + SALOMEDSImpl_AttributeSequenceOfReal* anSeq = dynamic_cast(with); + myValue.clear(); + for(int i = 0, len = anSeq->Length(); imyValue[i]); return; } @@ -110,96 +101,97 @@ void SALOMEDSImpl_AttributeSequenceOfReal::Restore(const Handle(TDF_Attribute)& //purpose : //======================================================================= -void SALOMEDSImpl_AttributeSequenceOfReal::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const +void SALOMEDSImpl_AttributeSequenceOfReal::Paste (DF_Attribute* into) { - if(!myValue.IsNull()) { - Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast (into)->Assign(myValue); - } + dynamic_cast(into)->Assign(myValue); } -void SALOMEDSImpl_AttributeSequenceOfReal::Assign(const Handle(TColStd_HSequenceOfReal)& other) +void SALOMEDSImpl_AttributeSequenceOfReal::Assign(const vector& other) { CheckLocked(); Backup(); - if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal; - myValue->ChangeSequence() = other->Sequence(); + myValue = other; 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) +void SALOMEDSImpl_AttributeSequenceOfReal::ChangeValue(const int Index,const double& Value) { CheckLocked(); Backup(); - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); - myValue->SetValue(Index, Value); + myValue[Index-1] = Value; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeSequenceOfReal::Add(const Standard_Real Value) +void SALOMEDSImpl_AttributeSequenceOfReal::Add(const double& Value) { CheckLocked(); Backup(); - myValue->Append(Value); + myValue.push_back(Value); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const Standard_Integer Index) +void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const int Index) { CheckLocked(); Backup(); - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); - myValue->Remove(Index); - - SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved + typedef vector::iterator VI; + int i = 1; + for(VI p = myValue.begin(); p!=myValue.end(); p++, i++) { + if(i == Index) { + myValue.erase(p); + break; + } + } + + SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Standard_Integer SALOMEDSImpl_AttributeSequenceOfReal::Length() +int SALOMEDSImpl_AttributeSequenceOfReal::Length() { - return myValue->Length(); + return myValue.size(); } -Standard_Real SALOMEDSImpl_AttributeSequenceOfReal::Value(const Standard_Integer Index) +double SALOMEDSImpl_AttributeSequenceOfReal::Value(const int Index) { - if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range"); - return myValue->Value(Index); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); + return myValue[Index-1]; } -TCollection_AsciiString SALOMEDSImpl_AttributeSequenceOfReal::Save() +string SALOMEDSImpl_AttributeSequenceOfReal::Save() { - Standard_Integer aLength = Length(); - char* aResult = new char[aLength * 25]; + int aLength = Length(); + char* aResult = new char[aLength * 127]; aResult[0] = 0; - Standard_Integer aPosition = 0; + int aPosition = 0; for (int i = 1; i <= aLength; i++) { - sprintf(aResult + aPosition , "%f ", Value(i)); + sprintf(aResult + aPosition , "%.64e ", Value(i)); aPosition += strlen(aResult + aPosition); } - TCollection_AsciiString ret(aResult); + string ret(aResult); delete aResult; return ret; } -void SALOMEDSImpl_AttributeSequenceOfReal::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeSequenceOfReal::Load(const string& value) { - Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal; - char* aCopy = value.ToCString(); + char* aCopy = (char*)value.c_str(); char* adr = strtok(aCopy, " "); char *err = NULL; while (adr) { - Standard_Real r = strtod(adr, &err); - CasCadeSeq->Append(r); + double r = strtod(adr, &err); + Add(r); adr = strtok(NULL, " "); } - Assign(CasCadeSeq); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.hxx index 273b67b26..10ebdf846 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeSequenceOfReal.hxx @@ -24,48 +24,39 @@ #ifndef _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile #define _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include +#include #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 virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSequenceOfReal Set(const TDF_Label& label) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeSequenceOfReal* Set(const DF_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 void Assign(const std::vector& other) ; +Standard_EXPORT void ChangeValue(const int Index,const double& Value) ; +Standard_EXPORT void Add(const double& Value) ; +Standard_EXPORT double Value(const int Index) ; +Standard_EXPORT void Remove(const int Index) ; +Standard_EXPORT int Length() ; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeSequenceOfReal() {} +Standard_EXPORT const std::vector& Array() { return myValue; } private: -Handle_TColStd_HSequenceOfReal myValue; - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeSequenceOfReal ) +std::vector myValue; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx index 7a7ee76a9..9bdc26b23 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx @@ -27,24 +27,21 @@ using namespace std; #endif -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) - //======================================================================= //function : GetID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeString::GetID () +const std::string& SALOMEDSImpl_AttributeString::GetID () { - static Standard_GUID CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9"); + static std::string CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9"); return CommentID; } -Handle(SALOMEDSImpl_AttributeString) SALOMEDSImpl_AttributeString::Set (const TDF_Label& L, - const TCollection_ExtendedString& Val) +SALOMEDSImpl_AttributeString* SALOMEDSImpl_AttributeString::Set (const DF_Label& L, + const std::string& Val) { - Handle(SALOMEDSImpl_AttributeString) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeString::GetID(), A)) { + SALOMEDSImpl_AttributeString* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeString*)L.FindAttribute(SALOMEDSImpl_AttributeString::GetID()))) { A = new SALOMEDSImpl_AttributeString(); L.AddAttribute(A); } @@ -58,7 +55,7 @@ Handle(SALOMEDSImpl_AttributeString) SALOMEDSImpl_AttributeString::Set (const TD //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeString::SetValue (const TCollection_ExtendedString& S) +void SALOMEDSImpl_AttributeString::SetValue (const std::string& S) { CheckLocked(); @@ -76,13 +73,13 @@ void SALOMEDSImpl_AttributeString::SetValue (const TCollection_ExtendedString& S //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeString::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeString::ID () const { return GetID(); } //======================================================================= //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeString::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeString::NewEmpty () const { return new SALOMEDSImpl_AttributeString(); } @@ -91,9 +88,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeString::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeString::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeString::Restore(DF_Attribute* with) { - myString = Handle(SALOMEDSImpl_AttributeString)::DownCast (with)->Value (); + myString = dynamic_cast(with)->Value (); } //======================================================================= @@ -101,8 +98,7 @@ void SALOMEDSImpl_AttributeString::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeString::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeString::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeString)::DownCast (into)->SetValue(myString); + dynamic_cast(into)->SetValue(myString); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx index ec0711106..2f7bb8587 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx @@ -24,47 +24,37 @@ #ifndef _SALOMEDSImpl_AttributeString_HeaderFile #define _SALOMEDSImpl_AttributeString_HeaderFile -#include -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) class SALOMEDSImpl_AttributeString : public SALOMEDSImpl_GenericAttribute { private: - TCollection_ExtendedString myString; + std::string myString; public: -Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static const std::string& GetID() ; Standard_EXPORT SALOMEDSImpl_AttributeString() :SALOMEDSImpl_GenericAttribute("AttributeString") {} -Standard_EXPORT static Handle(SALOMEDSImpl_AttributeString) 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 static SALOMEDSImpl_AttributeString* Set(const DF_Label& L, const std::string& Val); +Standard_EXPORT void SetValue (const std::string& S); +Standard_EXPORT std::string 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 virtual std::string Save() { return myString; } +Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeString() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeString ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx index b25d2fa02..a70e8a413 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx @@ -22,56 +22,51 @@ // Module : SALOME #include -#include -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute ) -const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::GetID() +const std::string& SALOMEDSImpl_AttributeStudyProperties::GetID() { - static Standard_GUID SALOMEDSImpl_AttributeStudyPropertiesID ("128371A2-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeStudyPropertiesID ("128371A2-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeStudyPropertiesID; } -Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_AttributeStudyProperties::Set(const TDF_Label& label) +SALOMEDSImpl_AttributeStudyProperties* SALOMEDSImpl_AttributeStudyProperties::Set(const DF_Label& label) { - Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr; - if (!label.FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(),anAttr)) { - anAttr = new SALOMEDSImpl_AttributeStudyProperties(); - label.AddAttribute(anAttr); + SALOMEDSImpl_AttributeStudyProperties* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeStudyProperties*)label.FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID()))) { + A = new SALOMEDSImpl_AttributeStudyProperties(); + label.AddAttribute(A); } - return anAttr; + return A; } SALOMEDSImpl_AttributeStudyProperties::SALOMEDSImpl_AttributeStudyProperties() :SALOMEDSImpl_GenericAttribute("AttributeStudyProperties") { - myLocked = Standard_False; - myLockChanged = Standard_False; + myLocked = false; + myLockChanged = 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; + myUserName.clear(); + myMinute.clear(); + myHour.clear(); + myDay.clear(); + myMonth.clear(); + myYear.clear(); 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) +void SALOMEDSImpl_AttributeStudyProperties::SetModification(const std::string& theUserName, + const int theMinute, + const int theHour, + const int theDay, + const int theMonth, + const int theYear) { if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 || theDay<0 || theDay>31 || theMonth<0 || theMonth>12) @@ -80,21 +75,21 @@ void SALOMEDSImpl_AttributeStudyProperties::SetModification(const TCollection_Ex CheckLocked(); Backup(); - myUserName->Append(theUserName); - myMinute->Append(theMinute); - myHour->Append(theHour); - myDay->Append(theDay); - myMonth->Append(theMonth); - myYear->Append(theYear); + myUserName.push_back(theUserName); + myMinute.push_back(theMinute); + myHour.push_back(theHour); + myDay.push_back(theDay); + myMonth.push_back(theMonth); + myYear.push_back(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 + (vector& theUserNames, + vector& theMinutes, + vector& theHours, + vector& theDays, + vector& theMonths, + vector& theYears) const { theUserNames = myUserName; theMinutes = myMinute; @@ -104,131 +99,130 @@ void SALOMEDSImpl_AttributeStudyProperties::GetModifications theYears = myYear; } -TCollection_ExtendedString SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const +std::string SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const { - if (myUserName->Length() == 0) - return TCollection_ExtendedString(""); - return myUserName->Value(1); + if (myUserName.size() == 0) + return std::string(""); + return myUserName[0]; } -Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::GetCreationDate - (Standard_Integer& theMinute, - Standard_Integer& theHour, - Standard_Integer& theDay, - Standard_Integer& theMonth, - Standard_Integer& theYear) const +bool SALOMEDSImpl_AttributeStudyProperties::GetCreationDate + (int& theMinute, + int& theHour, + int& theDay, + int& theMonth, + int& 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; + if (myMinute.size() != 0) { + theMinute = myMinute[0]; + theHour = myHour[0]; + theDay = myDay[0]; + theMonth = myMonth[0]; + theYear = myYear[0]; + return true; } - return Standard_False; + return false; } -void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const TCollection_ExtendedString& theName) +void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const std::string& theName) { - if (myUserName->Length() > 0) { + if (myUserName.size() > 0) { CheckLocked(); Backup(); - myUserName->SetValue(1, theName); + myUserName[0] = theName; } } -void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const Standard_Integer theMode) +void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const int theMode) { CheckLocked(); Backup(); myMode = theMode; } -Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetCreationMode() const +int SALOMEDSImpl_AttributeStudyProperties::GetCreationMode() const { return myMode; } -void SALOMEDSImpl_AttributeStudyProperties::SetModified(const Standard_Integer theModified) +void SALOMEDSImpl_AttributeStudyProperties::SetModified(const int theModified) { myModified = theModified; } -Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsModified() const +bool SALOMEDSImpl_AttributeStudyProperties::IsModified() const { return (myModified != 0); } -Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetModified() const +int SALOMEDSImpl_AttributeStudyProperties::GetModified() const { return myModified; } -void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const Standard_Boolean theLocked) +void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const bool theLocked) { // Backup(); if (myLocked != theLocked) { - myLockChanged = Standard_True; + myLockChanged = true; myLocked = theLocked; } } -Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsLocked() const +bool 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; +bool SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const bool theErase) { + if (!myLockChanged) return false; + if (theErase) myLockChanged = false; + return true; } -const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::ID() const +const std::string& SALOMEDSImpl_AttributeStudyProperties::ID() const { return GetID(); } -void SALOMEDSImpl_AttributeStudyProperties::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeStudyProperties::Restore(DF_Attribute* with) { - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(with); + SALOMEDSImpl_AttributeStudyProperties* aProp = + dynamic_cast(with); + Init(); - Standard_Integer i; - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + vector aNames; + vector 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)); + for (int i = 0, len = aNames.size(); i < len; i++) { + myUserName.push_back(aNames[i]); + myMinute.push_back(aMinutes[i]); + myHour.push_back(aHours[i]); + myDay.push_back(aDays[i]); + myMonth.push_back(aMonths[i]); + myYear.push_back(aYears[i]); } myMode = aProp->GetCreationMode(); // myModified = aProp->GetModified(); // myLocked = aProp->IsLocked(); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributeStudyProperties::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeStudyProperties::NewEmpty() const { return new SALOMEDSImpl_AttributeStudyProperties(); } -void SALOMEDSImpl_AttributeStudyProperties::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const +void SALOMEDSImpl_AttributeStudyProperties::Paste(DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = - Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(into); + SALOMEDSImpl_AttributeStudyProperties* aProp = + dynamic_cast(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)); + int i; + for(i = 0; i < myUserName.size(); i++) { + aProp->SetModification(myUserName[i], + myMinute[i], myHour[i], + myDay[i], myMonth[i], myYear[i]); } aProp->SetCreationMode(myMode); @@ -237,53 +231,53 @@ void SALOMEDSImpl_AttributeStudyProperties::Paste(const Handle(TDF_Attribute)& i } -TCollection_AsciiString SALOMEDSImpl_AttributeStudyProperties::Save() +string SALOMEDSImpl_AttributeStudyProperties::Save() { - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + vector aNames; + vector 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; + for (aLength = 0, anIndex = aNames.size()-1; anIndex >= 0; anIndex--) + aLength += aNames[anIndex].size() + 1; - char* aProperty = new char[3 + aLength + 12 * aNames->Length()]; + char* aProperty = new char[3 + aLength + 12 * aNames.size()]; char crMode = (char)GetCreationMode(); sprintf(aProperty,"%c%c", crMode, IsLocked()?'l':'u'); - aLength = aNames->Length(); + aLength = aNames.size(); int a = 2; - for (anIndex = 1; anIndex <= aLength; anIndex++) { + for (anIndex = 0; 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())); + (int)(aMinutes[anIndex]), + (int)(aHours[anIndex]), + (int)(aDays[anIndex]), + (int)(aMonths[anIndex]), + (int)(aYears[anIndex]), + (char*)(aNames[anIndex].c_str())); a = strlen(aProperty); aProperty[a++] = 1; } aProperty[a] = 0; - TCollection_AsciiString prop(aProperty); + string prop(aProperty); delete aProperty; return prop; } -void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeStudyProperties::Load(const string& value) { - char* aCopy = value.ToCString(); + char* aCopy = (char*)value.c_str(); int crMode = (int)aCopy[0]; SetCreationMode(crMode); int anIndex; - for (anIndex = 2; anIndex + 2 < value.Length() ;) { + for (anIndex = 2; anIndex + 2 < value.size() ;) { char str[10]; - Standard_Integer aMinute, aHour, aDay, aMonth, aYear; + int aMinute, aHour, aDay, aMonth, aYear; str[0] = aCopy[anIndex++]; str[1] = aCopy[anIndex++]; str[2] = 0; @@ -314,7 +308,7 @@ void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& anIndex += aNameSize + 1; } if (aCopy[1] == 'l') { - SetLocked(Standard_True); + SetLocked(true); } SetModified(0); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx index 4d0dbc450..c520bce61 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx @@ -24,92 +24,77 @@ #ifndef _SALOMEDSImpl_AttributeStudyProperties_HeaderFile #define _SALOMEDSImpl_AttributeStudyProperties_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include +#include #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute ) - -#include -#include - 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 const std::string& GetID(); +Standard_EXPORT const std::string& ID() const; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeStudyProperties Set(const TDF_Label& label); +Standard_EXPORT static SALOMEDSImpl_AttributeStudyProperties* Set(const DF_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; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); + +Standard_EXPORT void SetModification(const std::string& theUserName, + const int theMinute, + const int theHour, + const int theDay, + const int theMonth, + const int theYear); +Standard_EXPORT void GetModifications(std::vector& theUserNames, + std::vector& theMinutes, + std::vector& theHours, + std::vector& theDays, + std::vector& theMonths, + std::vector& theYears) const; + +Standard_EXPORT std::string GetCreatorName() const; +Standard_EXPORT bool GetCreationDate(int& theMinute, + int& theHour, + int& theDay, + int& theMonth, + int& theYear) const; + +Standard_EXPORT void ChangeCreatorName(const std::string& theUserName); + +Standard_EXPORT void SetCreationMode(const int theMode); +Standard_EXPORT int GetCreationMode() const; + +Standard_EXPORT void SetModified(const int theModified); +Standard_EXPORT bool IsModified() const; +Standard_EXPORT int GetModified() const; + +Standard_EXPORT void SetLocked(const bool theLocked); +Standard_EXPORT bool IsLocked() const; +Standard_EXPORT bool IsLockChanged(const bool theErase); + +Standard_EXPORT void Restore(DF_Attribute* with); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); 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 ) +std::vector myUserName; +std::vector myMinute; +std::vector myHour; +std::vector myDay; +std::vector myMonth; +std::vector myYear; +int myMode; +int myModified; +bool myLocked; +bool myLockChanged; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx index 955a6fe1a..a4bab5781 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx @@ -21,92 +21,84 @@ // Author : Michael Ponikarov // Module : SALOME -#include -#include -#include -#include -#include +#include "SALOMEDSImpl_AttributeTableOfInteger.hxx" +#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute ) - #define SEPARATOR '\1' +typedef map::const_iterator MI; -static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString) +static std::string getUnit(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString(); - return aString.Split(aPos); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); + if(aPos <= 0 || aPos == aString.size() ) return std::string(); + return aString.substr(aPos+1, aString.size()); } -static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) +static std::string getTitle(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); if(aPos < 1) return aString; - if(aPos == 1) return TCollection_ExtendedString(); - aString.Split(aPos-1); - return aString; + if(aPos == 1) return std::string(); + return aString.substr(0, aPos); } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfInteger::GetID() +const std::string& SALOMEDSImpl_AttributeTableOfInteger::GetID() { - static Standard_GUID SALOMEDSImpl_AttributeTableOfIntegerID ("128371A0-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTableOfIntegerID ("128371A0-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTableOfIntegerID; } -Handle(SALOMEDSImpl_AttributeTableOfInteger) SALOMEDSImpl_AttributeTableOfInteger::Set(const TDF_Label& label) +SALOMEDSImpl_AttributeTableOfInteger* SALOMEDSImpl_AttributeTableOfInteger::Set(const DF_Label& label) { - Handle(SALOMEDSImpl_AttributeTableOfInteger) anAttr; - if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfInteger::GetID(),anAttr)) { - anAttr = new SALOMEDSImpl_AttributeTableOfInteger(); - label.AddAttribute(anAttr); + SALOMEDSImpl_AttributeTableOfInteger* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeTableOfInteger*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfInteger::GetID()))) { + A = new SALOMEDSImpl_AttributeTableOfInteger(); + label.AddAttribute(A); } - return anAttr; + return A; } 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) +void SALOMEDSImpl_AttributeTableOfInteger::SetNbColumns(const int theNbColumns) { CheckLocked(); Backup(); - TColStd_DataMapOfIntegerInteger aMap; + map aMap; aMap = myTable; - myTable.Clear(); + 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)); + + for(MI p = aMap.begin(); p != aMap.end(); p++) { + int aRow = (int)(p->first/myNbColumns) + 1; + int aCol = (int)(p->first - myNbColumns*(aRow-1)); if(aCol == 0) { aCol = myNbColumns; aRow--; } if(aCol > theNbColumns) continue; int aKey = (aRow-1)*theNbColumns+aCol; - myTable.Bind(aKey, anIterator.Value()); + myTable[aKey] = p->second; } myNbColumns = theNbColumns; - while (myCols->Length() < myNbColumns) { // append empty columns titles - myCols->Append(TCollection_ExtendedString("")); + while (myCols.size() < myNbColumns) { // append empty columns titles + myCols.push_back(std::string("")); } SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const std::string& theTitle) { CheckLocked(); Backup(); @@ -115,26 +107,26 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const TCollection_ExtendedSt SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetTitle() const +std::string SALOMEDSImpl_AttributeTableOfInteger::GetTitle() const { return myTitle; } -void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfInteger)& theData) +void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const int theRow, + const vector& theData) { CheckLocked(); - if(theData->Length() > myNbColumns) SetNbColumns(theData->Length()); + if(theData.size() > myNbColumns) SetNbColumns(theData.size()); Backup(); - while (myRows->Length() < theRow) { // append new row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append new row titles + myRows.push_back(std::string("")); } - Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length(); + int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(aShift + i, theData->Value(i)); + myTable[aShift + i] = theData[i-1]; } if(theRow > myNbRows) myNbRows = theRow; @@ -142,113 +134,113 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const Standard_Integer the SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfInteger) SALOMEDSImpl_AttributeTableOfInteger::GetRowData(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfInteger::GetRowData(const int theRow) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger(); - Standard_Integer i, aShift = (theRow-1)*myNbColumns; + vector aSeq; + int i, aShift = (theRow-1)*myNbColumns; for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift+i)) - aSeq->Append(myTable.Find(aShift+i)); + if(myTable.find(aShift+i) != myTable.end()) + aSeq.push_back(myTable[aShift+i]); else - aSeq->Append(0); + aSeq.push_back(0); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitle(const int theRow, + const std::string& theTitle) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow); - if(aUnit.Length()>0) { + string aTitle(theTitle), aUnit = GetRowUnit(theRow); + if(aUnit.size()>0) { aTitle += SEPARATOR; aTitle += aUnit; } - myRows->SetValue(theRow, aTitle); + myRows[theRow-1] = 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) +void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnit(const int theRow, + const std::string& theUnit) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle = GetRowTitle(theRow); + std::string aTitle = GetRowTitle(theRow); aTitle += SEPARATOR; aTitle += theUnit; - myRows->SetValue(theRow, aTitle); + myRows[theRow-1] = aTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) +void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const vector& 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)); + if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theUnits.size(), i; + for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits() +vector 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))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; i& 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)); + if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theTitles.size(), i; + for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles() +vector 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))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; iValue(theRow)); + return getTitle(myRows[theRow-1]); } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetRowUnit(const Standard_Integer theRow) const +std::string SALOMEDSImpl_AttributeTableOfInteger::GetRowUnit(const int theRow) const { - return getUnit(myRows->Value(theRow)); + return getUnit(myRows[theRow-1]); } -void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfInteger)& theData) +void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const int theColumn, + const vector& theData) { CheckLocked(); if(theColumn > myNbColumns) SetNbColumns(theColumn); Backup(); - Standard_Integer i, aLength = theData->Length(); + int i, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i)); + myTable[myNbColumns*(i-1)+theColumn] = theData[i-1]; } if(aLength > myNbRows) { myNbRows = aLength; - while (myRows->Length() < myNbRows) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < myNbRows) { // append empty row titles + myRows.push_back(std::string("")); } } @@ -256,80 +248,79 @@ void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const Standard_Integer } -Handle(TColStd_HSequenceOfInteger) SALOMEDSImpl_AttributeTableOfInteger::GetColumnData(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfInteger::GetColumnData(const int theColumn) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; - - Standard_Integer i, anIndex; + vector aSeq; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1) + theColumn; - if(myTable.IsBound(anIndex)) - aSeq->Append(myTable.Find(anIndex)); + if(myTable.find(anIndex) != myTable.end()) + aSeq.push_back(myTable[anIndex]); else - aSeq->Append(0); + aSeq.push_back(0); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const int theColumn, + const std::string& theTitle) { CheckLocked(); Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); + while(myCols.size() < theColumn) myCols.push_back(std::string("")); + myCols[theColumn-1] = theTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const Standard_Integer theColumn) const +std::string SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const int theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); + if(myCols.empty()) return ""; + if(myCols.size() < theColumn) return ""; + return myCols[theColumn-1]; } -void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) +void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const vector& 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)); + if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns"); + int aLength = theTitles.size(), i; + for(i = 0; i < aLength; i++) myCols[i] = theTitles[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles() +vector 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)); + vector aSeq; + int aLength = myCols.size(), i; + for(i=0; i myNbColumns) SetNbColumns(theColumn); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - myTable.Bind(anIndex, theValue); + int anIndex = (theRow-1)*myNbColumns + theColumn; + myTable[anIndex] = theValue; if(theRow > myNbRows) { - while (myRows->Length() < theRow) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append empty row titles + myRows.push_back(std::string("")); } myNbRows = theRow; } @@ -337,41 +328,42 @@ void SALOMEDSImpl_AttributeTableOfInteger::PutValue(const Standard_Integer theVa 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) +bool SALOMEDSImpl_AttributeTableOfInteger::HasValue(const int theRow, + const int 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); + if(theRow > myNbRows || theRow < 1) return false; + if(theColumn > myNbColumns || theColumn < 1) return false; + int anIndex = (theRow-1)*myNbColumns + theColumn; + return (myTable.find(anIndex) != myTable.end()); } -Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) +int SALOMEDSImpl_AttributeTableOfInteger::GetValue(const int theRow, + const int theColumn) { - if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index"); - if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index"); + if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index"); + if(theColumn > myNbColumns || theColumn < 1) DFexception("Invalid cell index"); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - if(myTable.IsBound(anIndex)) return myTable.Find(anIndex); + int anIndex = (theRow-1)*myNbColumns + theColumn; + if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex]; - Standard_Failure::Raise("Invalid cell index"); + throw DFexception("Invalid cell index"); return 0; } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfInteger::ID() const +const std::string& SALOMEDSImpl_AttributeTableOfInteger::ID() const { return GetID(); } -void SALOMEDSImpl_AttributeTableOfInteger::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeTableOfInteger::Restore(DF_Attribute* with) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(with); + int anIndex; + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(with); + if(!aTable) throw DFexception("Can't Restore from a null attribute"); - myTable.Clear(); - myCols->Clear(); - myRows->Clear(); + myTable.clear(); + myCols.clear(); + myRows.clear(); myTable = aTable->myTable; myNbRows = aTable->myNbRows; @@ -379,26 +371,26 @@ void SALOMEDSImpl_AttributeTableOfInteger::Restore(const Handle(TDF_Attribute)& myTitle = aTable->myTitle; for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) - myRows->Append(aTable->GetRowTitle(anIndex)); + myRows.push_back(aTable->GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) - myCols->Append(aTable->GetColumnTitle(anIndex)); + myCols.push_back(aTable->GetColumnTitle(anIndex)); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfInteger::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeTableOfInteger::NewEmpty() const { return new SALOMEDSImpl_AttributeTableOfInteger(); } -void SALOMEDSImpl_AttributeTableOfInteger::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const +void SALOMEDSImpl_AttributeTableOfInteger::Paste(DF_Attribute* into) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(into); + int anIndex; + SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast(into); + if(!aTable) throw DFexception("Can't Paste into a null attribute"); - aTable->myTable.Clear(); - aTable->myCols->Clear(); - aTable->myRows->Clear(); + aTable->myTable.clear(); + aTable->myCols.clear(); + aTable->myRows.clear(); aTable->myTable = myTable; aTable->myTitle = myTitle; @@ -406,156 +398,141 @@ void SALOMEDSImpl_AttributeTableOfInteger::Paste(const Handle(TDF_Attribute)& in aTable->myNbColumns = myNbColumns; for(anIndex = 1; anIndex <= GetNbRows();anIndex++) - aTable->myRows->Append(GetRowTitle(anIndex)); + aTable->myRows.push_back(GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) - aTable->myCols->Append(GetColumnTitle(anIndex)); + aTable->myCols.push_back(GetColumnTitle(anIndex)); } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfInteger::GetSetRowIndices(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfInteger::GetSetRowIndices(const int theRow) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, aShift = myNbColumns*(theRow-1); + int i, aShift = myNbColumns*(theRow-1); for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift + i)) aSeq->Append(i); + if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i); } return aSeq; } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfInteger::GetSetColumnIndices(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfInteger::GetSetColumnIndices(const int theColumn) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, anIndex; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1)+theColumn; - if(myTable.IsBound(anIndex)) aSeq->Append(i); + if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfInteger::ConvertToString(ostrstream& theStream) +string SALOMEDSImpl_AttributeTableOfInteger::Save() { + ostrstream theStream; int i, j, l; theStream.precision(64); //Title - l = myTitle.Length(); + l = myTitle.size(); theStream << l << "\n"; - for(i=1; i<=l; i++) - theStream << myTitle.Value(i) << "\n"; + for(i=0; iValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jfirst << "\n"; + theStream << p->second << "\n"; } - return; + string aString((char*)theStream.rdbuf()->str()); + return aString; } -bool SALOMEDSImpl_AttributeTableOfInteger::RestoreFromString(istrstream& theStream) +void SALOMEDSImpl_AttributeTableOfInteger::Load(const string& value) { + istrstream theStream(value.c_str(), strlen(value.c_str())); Backup(); int i, j, l; - Standard_ExtCharacter anExtChar; - TCollection_ExtendedString aStr; + char anExtChar; + std::string aStr; //Title theStream >> l; - myTitle = TCollection_ExtendedString(l, 0); - for(i=1; i<=l; i++) { + myTitle = std::string(l, 0); + for(i=0; i> anExtChar; - myTitle.SetValue(i, anExtChar); + myTitle[i] = anExtChar; } //Nb rows theStream >> myNbRows; //Rows titles - myRows->Clear(); + myRows.clear(); for(i=1; i<=myNbRows; i++) { theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myRows->Append(aStr); + myRows.push_back(aStr); } //Nb columns theStream >> myNbColumns; //Columns titles - myCols->Clear(); + myCols.clear(); for(i=1; i<=myNbColumns; i++) { theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myCols->Append(aStr); + myCols.push_back(aStr); } //Restore the table values theStream >> l; - myTable.Clear(); + myTable.clear(); for(i=1; i<=l; i++) { int aKey, aValue; theStream >> aKey; theStream >> aValue; - myTable.Bind(aKey, aValue); + myTable[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); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.hxx index 4a44d76b8..84434df7b 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.hxx @@ -11,84 +11,68 @@ #ifndef _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile #define _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); +#include +#include +#include -#include -#include -#include -#include -#include -#include -#include - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute ) class SALOMEDSImpl_AttributeTableOfInteger : 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_AttributeTableOfInteger Set(const TDF_Label& label) ; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeTableOfInteger* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeTableOfInteger(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfInteger)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ; -Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const; -Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits(); -Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles(); -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfInteger)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles); -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles(); -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const Standard_Integer theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Integer GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -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 SetNbColumns(const int theNbColumns); +Standard_EXPORT void SetTitle(const std::string& theTitle) ; +Standard_EXPORT std::string GetTitle() const; +Standard_EXPORT void SetRowData(const int theRow,const std::vector& theData) ; +Standard_EXPORT std::vector GetRowData(const int theRow) ; +Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ; +Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ; +Standard_EXPORT std::string GetRowUnit(const int theRow) const; +Standard_EXPORT void SetRowUnits(const std::vector& theUnits) ; +Standard_EXPORT std::vector GetRowUnits(); +Standard_EXPORT void SetRowTitles(const std::vector& theTitles) ; +Standard_EXPORT std::vector GetRowTitles(); +Standard_EXPORT std::string GetRowTitle(const int theRow) const; +Standard_EXPORT void SetColumnData(const int theColumn,const std::vector& theData) ; +Standard_EXPORT std::vector GetColumnData(const int theColumn) ; +Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ; +Standard_EXPORT std::string GetColumnTitle(const int theColumn) const; +Standard_EXPORT void SetColumnTitles(const std::vector& theTitles); +Standard_EXPORT std::vector GetColumnTitles(); +Standard_EXPORT int GetNbRows() const; +Standard_EXPORT int GetNbColumns() const; -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); +Standard_EXPORT void PutValue(const int theValue,const int theRow,const int theColumn) ; +Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ; +Standard_EXPORT int GetValue(const int theRow,const int theColumn) ; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); +Standard_EXPORT std::vector GetSetRowIndices(const int theRow); +Standard_EXPORT std::vector GetSetColumnIndices(const int theColumn); Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfInteger() {} private: -TColStd_DataMapOfIntegerInteger myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; +std::map myTable; +std::string myTitle; +std::vector myRows; +std::vector myCols; +int myNbRows; +int myNbColumns; -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfInteger ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx index 7b4b259a6..62dd160b1 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx @@ -21,92 +21,84 @@ // Author : Michael Ponikarov // Module : SALOME -#include -#include -#include -#include +#include "SALOMEDSImpl_AttributeTableOfReal.hxx" #include -#include +#include 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) +typedef map::const_iterator MI; + +static std::string getUnit(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString(); - return aString.Split(aPos); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); + if(aPos <= 0 || aPos == aString.size() ) return std::string(); + return aString.substr(aPos+1, aString.size()); } -static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) +static std::string getTitle(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); if(aPos < 1) return aString; - if(aPos == 1) return TCollection_ExtendedString(); - aString.Split(aPos-1); - return aString; + if(aPos == 1) return std::string(); + return aString.substr(0, aPos); } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfReal::GetID() +const std::string& SALOMEDSImpl_AttributeTableOfReal::GetID() { - static Standard_GUID SALOMEDSImpl_AttributeTableOfRealID ("128371A1-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTableOfRealID ("128371A1-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTableOfRealID; } -Handle(SALOMEDSImpl_AttributeTableOfReal) SALOMEDSImpl_AttributeTableOfReal::Set(const TDF_Label& label) +SALOMEDSImpl_AttributeTableOfReal* SALOMEDSImpl_AttributeTableOfReal::Set(const DF_Label& label) { - Handle(SALOMEDSImpl_AttributeTableOfReal) anAttr; - if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfReal::GetID(),anAttr)) { - anAttr = new SALOMEDSImpl_AttributeTableOfReal(); - label.AddAttribute(anAttr); + SALOMEDSImpl_AttributeTableOfReal* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeTableOfReal*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfReal::GetID()))) { + A = new SALOMEDSImpl_AttributeTableOfReal(); + label.AddAttribute(A); } - return anAttr; + return A; } 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) +void SALOMEDSImpl_AttributeTableOfReal::SetNbColumns(const int theNbColumns) { CheckLocked(); Backup(); - TColStd_DataMapOfIntegerReal aMap; + map aMap; aMap = myTable; - myTable.Clear(); + 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)); + for(MI p = aMap.begin(); p != aMap.end(); p++) { + int aRow = (int)(p->first/myNbColumns) + 1; + int aCol = (int)(p->first - myNbColumns*(aRow-1)); if(aCol == 0) { aCol = myNbColumns; aRow--; } if(aCol > theNbColumns) continue; int aKey = (aRow-1)*theNbColumns+aCol; - myTable.Bind(aKey, anIterator.Value()); + myTable[aKey] = p->second; } myNbColumns = theNbColumns; - while (myCols->Length() < myNbColumns) { // append empty columns titles - myCols->Append(TCollection_ExtendedString("")); + while (myCols.size() < myNbColumns) { // append empty columns titles + myCols.push_back(string("")); } SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const std::string& theTitle) { CheckLocked(); Backup(); @@ -115,26 +107,26 @@ void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const TCollection_ExtendedStrin SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetTitle() const +std::string SALOMEDSImpl_AttributeTableOfReal::GetTitle() const { return myTitle; } -void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfReal)& theData) +void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const int theRow, + const vector& theData) { CheckLocked(); - if(theData->Length() > myNbColumns) SetNbColumns(theData->Length()); + if(theData.size() > myNbColumns) SetNbColumns(theData.size()); Backup(); - while (myRows->Length() < theRow) { // append new row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append new row titles + myRows.push_back(std::string("")); } - Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length(); + int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(aShift + i, theData->Value(i)); + myTable[aShift + i] = theData[i-1]; } if(theRow > myNbRows) myNbRows = theRow; @@ -142,113 +134,113 @@ void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const Standard_Integer theRow SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfReal) SALOMEDSImpl_AttributeTableOfReal::GetRowData(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfReal::GetRowData(const int theRow) { - Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal(); - Standard_Integer i, aShift = (theRow-1)*myNbColumns; + vector aSeq; + int i, aShift = (theRow-1)*myNbColumns; for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift+i)) - aSeq->Append(myTable.Find(aShift+i)); + if(myTable.find(aShift+i) != myTable.end()) + aSeq.push_back(myTable[aShift+i]); else - aSeq->Append(0.); + aSeq.push_back(0.); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfReal::SetRowTitle(const Standard_Integer theRow, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfReal::SetRowTitle(const int theRow, + const std::string& theTitle) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow); - if(aUnit.Length()>0) { + std::string aTitle(theTitle), aUnit = GetRowUnit(theRow); + if(aUnit.size()>0) { aTitle += SEPARATOR; aTitle += aUnit; } - myRows->SetValue(theRow, aTitle); + myRows[theRow-1] = 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) +void SALOMEDSImpl_AttributeTableOfReal::SetRowUnit(const int theRow, + const std::string& theUnit) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle = GetRowTitle(theRow); + std::string aTitle = GetRowTitle(theRow); aTitle += SEPARATOR; aTitle += theUnit; - - myRows->SetValue(theRow, aTitle); + + myRows[theRow-1] = aTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) +void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const vector& 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)); + if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theUnits.size(), i; + for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetRowUnits() +vector 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))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; i& 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)); + if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theTitles.size(), i; + for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetRowTitles() +vector 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))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; iValue(theRow)); + return getTitle(myRows[theRow-1]); } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetRowUnit(const Standard_Integer theRow) const +std::string SALOMEDSImpl_AttributeTableOfReal::GetRowUnit(const int theRow) const { - return getUnit(myRows->Value(theRow)); + return getUnit(myRows[theRow-1]); } -void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfReal)& theData) +void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const int theColumn, + const vector& theData) { CheckLocked(); if(theColumn > myNbColumns) SetNbColumns(theColumn); Backup(); - Standard_Integer i, aLength = theData->Length(); + int i, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i)); + myTable[myNbColumns*(i-1)+theColumn] = theData[i-1]; } if(aLength > myNbRows) { myNbRows = aLength; - while (myRows->Length() < myNbRows) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < myNbRows) { // append empty row titles + myRows.push_back(string("")); } } @@ -256,80 +248,80 @@ void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const Standard_Integer the } -Handle(TColStd_HSequenceOfReal) SALOMEDSImpl_AttributeTableOfReal::GetColumnData(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfReal::GetColumnData(const int theColumn) { - Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal; + vector aSeq; - Standard_Integer i, anIndex; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1) + theColumn; - if(myTable.IsBound(anIndex)) - aSeq->Append(myTable.Find(anIndex)); + if(myTable.find(anIndex) != myTable.end()) + aSeq.push_back(myTable[anIndex]); else - aSeq->Append(0.); + aSeq.push_back(0.); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitle(const int theColumn, + const std::string& theTitle) { CheckLocked(); Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); - + while(myCols.size() < theColumn) myCols.push_back(std::string("")); + myCols[theColumn-1] = theTitle; + SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetColumnTitle(const Standard_Integer theColumn) const +std::string SALOMEDSImpl_AttributeTableOfReal::GetColumnTitle(const int theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); + if(myCols.empty()) return ""; + if(myCols.size() < theColumn) return ""; + return myCols[theColumn-1]; } -void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) +void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitles(const vector& 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)); + if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns"); + int aLength = theTitles.size(), i; + for(i = 0; i < aLength; i++) myCols[i] = theTitles[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetColumnTitles() +vector 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)); + vector aSeq; + int aLength = myCols.size(), i; + for(i=0; i myNbColumns) SetNbColumns(theColumn); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - myTable.Bind(anIndex, theValue); + int anIndex = (theRow-1)*myNbColumns + theColumn; + myTable[anIndex] = theValue; if(theRow > myNbRows) { - while (myRows->Length() < theRow) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append empty row titles + myRows.push_back(std::string("")); } myNbRows = theRow; } @@ -337,41 +329,42 @@ void SALOMEDSImpl_AttributeTableOfReal::PutValue(const Standard_Real theValue, 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) +bool SALOMEDSImpl_AttributeTableOfReal::HasValue(const int theRow, + const int 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); + if(theRow > myNbRows || theRow < 1) return false; + if(theColumn > myNbColumns || theColumn < 1) return false; + int anIndex = (theRow-1)*myNbColumns + theColumn; + return (myTable.find(anIndex) != myTable.end()); } -Standard_Real SALOMEDSImpl_AttributeTableOfReal::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) +double SALOMEDSImpl_AttributeTableOfReal::GetValue(const int theRow, + const int theColumn) { - if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index"); - if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index"); + if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index"); + if(theColumn > myNbColumns || theColumn < 1) throw DFexception("Invalid cell index"); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - if(myTable.IsBound(anIndex)) return myTable.Find(anIndex); + int anIndex = (theRow-1)*myNbColumns + theColumn; + if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex]; - Standard_Failure::Raise("Invalid cell index"); + throw DFexception("Invalid cell index"); return 0.; } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfReal::ID() const +const std::string& SALOMEDSImpl_AttributeTableOfReal::ID() const { return GetID(); } -void SALOMEDSImpl_AttributeTableOfReal::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeTableOfReal::Restore(DF_Attribute* with) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(with); + int anIndex; + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(with); + if(!aTable) throw DFexception("Can't Restore from a null attribute"); - myTable.Clear(); - myCols->Clear(); - myRows->Clear(); + myTable.clear(); + myCols.clear(); + myRows.clear(); myTable = aTable->myTable; myNbRows = aTable->myNbRows; @@ -379,26 +372,26 @@ void SALOMEDSImpl_AttributeTableOfReal::Restore(const Handle(TDF_Attribute)& wit myTitle = aTable->myTitle; for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) - myRows->Append(aTable->GetRowTitle(anIndex)); + myRows.push_back(aTable->GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) - myCols->Append(aTable->GetColumnTitle(anIndex)); + myCols.push_back(aTable->GetColumnTitle(anIndex)); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfReal::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeTableOfReal::NewEmpty() const { return new SALOMEDSImpl_AttributeTableOfReal(); } -void SALOMEDSImpl_AttributeTableOfReal::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const +void SALOMEDSImpl_AttributeTableOfReal::Paste(DF_Attribute* into) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(into); + int anIndex; + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(into); + if(!aTable) throw DFexception("Can't Paste into a null attribute"); - aTable->myTable.Clear(); - aTable->myCols->Clear(); - aTable->myRows->Clear(); + aTable->myTable.clear(); + aTable->myCols.clear(); + aTable->myRows.clear(); aTable->myTable = myTable; aTable->myTitle = myTitle; @@ -406,160 +399,143 @@ void SALOMEDSImpl_AttributeTableOfReal::Paste(const Handle(TDF_Attribute)& into, aTable->myNbColumns = myNbColumns; for(anIndex = 1; anIndex <= GetNbRows();anIndex++) - aTable->myRows->Append(GetRowTitle(anIndex)); + aTable->myRows.push_back(GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) - aTable->myCols->Append(GetColumnTitle(anIndex)); + aTable->myCols.push_back(GetColumnTitle(anIndex)); } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfReal::GetSetRowIndices(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfReal::GetSetRowIndices(const int theRow) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, aShift = myNbColumns*(theRow-1); + int i, aShift = myNbColumns*(theRow-1); for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift + i)) aSeq->Append(i); + if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i); } return aSeq; } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfReal::GetSetColumnIndices(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfReal::GetSetColumnIndices(const int theColumn) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, anIndex; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1)+theColumn; - if(myTable.IsBound(anIndex)) aSeq->Append(i); + if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i); } return aSeq; } - - -void SALOMEDSImpl_AttributeTableOfReal::ConvertToString(ostrstream& theStream) +string SALOMEDSImpl_AttributeTableOfReal::Save() { + ostrstream theStream; int i, j, l; - //Title - l = myTitle.Length(); + l = myTitle.size(); theStream << l << "\n"; - for(i=1; i<=l; i++) - theStream << myTitle.Value(i) << "\n"; + for(i=0; iValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jfirst << "\n"; + sprintf(aBuffer, "%.64e", p->second); theStream << aBuffer << "\n"; } delete []aBuffer; - - return; + string aString((char*)theStream.rdbuf()->str()); + return aString; } -bool SALOMEDSImpl_AttributeTableOfReal::RestoreFromString(istrstream& theStream) +void SALOMEDSImpl_AttributeTableOfReal::Load(const string& value) { + istrstream theStream(value.c_str(), strlen(value.c_str())); Backup(); int i, j, l; - Standard_ExtCharacter anExtChar; - TCollection_ExtendedString aStr; + char anExtChar; + std::string aStr; //Title theStream >> l; - myTitle = TCollection_ExtendedString(l, 0); - for(i=1; i<=l; i++) { + myTitle = std::string(l, 0); + for(i=0; i> anExtChar; - myTitle.SetValue(i, anExtChar); + myTitle[i] = anExtChar; } //Nb rows theStream >> myNbRows; //Rows titles - myRows->Clear(); + myRows.clear(); for(i=1; i<=myNbRows; i++) { theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myRows->Append(aStr); + myRows.push_back(aStr); } //Nb columns theStream >> myNbColumns; //Columns titles - myCols->Clear(); + myCols.clear(); for(i=1; i<=myNbColumns; i++) { theStream >> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myCols->Append(aStr); + myCols.push_back(aStr); } //Restore the table values theStream >> l; - myTable.Clear(); + myTable.clear(); for(i=1; i<=l; i++) { - Standard_Integer aKey; - Standard_Real aValue; + int aKey; + double aValue; theStream >> aKey; theStream >> aValue; - myTable.Bind(aKey, aValue); + myTable[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); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.hxx index 6c1b7b28a..3dea7567d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.hxx @@ -11,86 +11,65 @@ #ifndef _SALOMEDSImpl_AttributeTableOfReal_HeaderFile #define _SALOMEDSImpl_AttributeTableOfReal_HeaderFile -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute ) - -#include -#include -#include -#include -#include -#include - -#include -#include +#include +#include +#include class SALOMEDSImpl_AttributeTableOfReal : 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_AttributeTableOfReal Set(const TDF_Label& label) ; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeTableOfReal* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeTableOfReal(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfReal)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfReal GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ; -Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const; -Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits(); -Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles(); -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfReal)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfReal GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles); -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles(); -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const Standard_Real theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Real GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -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 Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); - -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); +Standard_EXPORT void SetNbColumns(const int theNbColumns); +Standard_EXPORT void SetTitle(const std::string& theTitle) ; +Standard_EXPORT std::string GetTitle() const; +Standard_EXPORT void SetRowData(const int theRow,const std::vector& theData) ; +Standard_EXPORT std::vector GetRowData(const int theRow) ; +Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ; +Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ; +Standard_EXPORT std::string GetRowUnit(const int theRow) const; +Standard_EXPORT void SetRowUnits(const std::vector& theUnits) ; +Standard_EXPORT std::vector GetRowUnits(); +Standard_EXPORT void SetRowTitles(const std::vector& theTitles) ; +Standard_EXPORT std::vector GetRowTitles(); +Standard_EXPORT std::string GetRowTitle(const int theRow) const; +Standard_EXPORT void SetColumnData(const int theColumn,const std::vector& theData) ; +Standard_EXPORT std::vector GetColumnData(const int theColumn) ; +Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ; +Standard_EXPORT void SetColumnTitles(const std::vector& theTitles); +Standard_EXPORT std::vector GetColumnTitles(); +Standard_EXPORT std::string GetColumnTitle(const int theColumn) const; +Standard_EXPORT int GetNbRows() const; +Standard_EXPORT int GetNbColumns() const; + +Standard_EXPORT void PutValue(const double& theValue,const int theRow,const int theColumn) ; +Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ; +Standard_EXPORT double GetValue(const int theRow,const int theColumn) ; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); + +Standard_EXPORT std::vector GetSetRowIndices(const int theRow); +Standard_EXPORT std::vector GetSetColumnIndices(const int theColumn); Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfReal() {} private: -TColStd_DataMapOfIntegerReal myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfReal ) +std::map myTable; +std::string myTitle; +std::vector myRows; +std::vector myCols; +int myNbRows; +int myNbColumns; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx index e6b74e048..23ba72c3f 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx @@ -22,179 +22,171 @@ // Module : SALOME #include -#include -#include #include -#include +#include +#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute ) - -typedef NCollection_DataMap::Iterator DataMapIterator; - #define SEPARATOR '\1' -static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString) +typedef map::const_iterator MI; + +static std::string getUnit(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); - if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString(); - return aString.Split(aPos); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); + if(aPos <= 0 || aPos == aString.size() ) return std::string(); + return aString.substr(aPos+1, aString.size()); } -static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString) +static std::string getTitle(std::string theString) { - TCollection_ExtendedString aString(theString); - int aPos = aString.Search(SEPARATOR); + std::string aString(theString); + int aPos = aString.find(SEPARATOR); if(aPos < 1) return aString; - if(aPos == 1) return TCollection_ExtendedString(); - aString.Split(aPos-1); - return aString; + if(aPos == 1) return std::string(); + return aString.substr(0, aPos); } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::GetID() +const std::string& SALOMEDSImpl_AttributeTableOfString::GetID() { - static Standard_GUID SALOMEDSImpl_AttributeTableOfStringID ("128371A4-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTableOfStringID ("128371A4-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTableOfStringID; } -Handle(SALOMEDSImpl_AttributeTableOfString) SALOMEDSImpl_AttributeTableOfString::Set(const TDF_Label& label) +SALOMEDSImpl_AttributeTableOfString* SALOMEDSImpl_AttributeTableOfString::Set(const DF_Label& label) { - Handle(SALOMEDSImpl_AttributeTableOfString) anAttr; - if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID(),anAttr)) { - anAttr = new SALOMEDSImpl_AttributeTableOfString(); - label.AddAttribute(anAttr); + SALOMEDSImpl_AttributeTableOfString* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeTableOfString*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID()))) { + A = new SALOMEDSImpl_AttributeTableOfString(); + label.AddAttribute(A); } - return anAttr; + return A; } 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) +void SALOMEDSImpl_AttributeTableOfString::SetNbColumns(const int theNbColumns) { CheckLocked(); Backup(); - DataMapOfIntegerString aMap; + map aMap; aMap = myTable; - myTable.Clear(); + 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)); + for(MI p = aMap.begin(); p!=aMap.end(); p++) { + int aRow = (int)(p->first/myNbColumns) + 1; + int aCol = (int)(p->first - myNbColumns*(aRow-1)); if(aCol == 0) { aCol = myNbColumns; aRow--; } if(aCol > theNbColumns) continue; int aKey = (aRow-1)*theNbColumns+aCol; - myTable.Bind(aKey, anIterator.Value()); + myTable[aKey] = p->second; } myNbColumns = theNbColumns; - while (myCols->Length() < myNbColumns) { // append empty columns titles - myCols->Append(TCollection_ExtendedString("")); + while (myCols.size() < myNbColumns) { // append empty columns titles + myCols.push_back(std::string("")); } 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) +void SALOMEDSImpl_AttributeTableOfString::SetRowTitle(const int theRow, + const std::string& theTitle) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow); - if(aUnit.Length()>0) { + std::string aTitle(theTitle), aUnit = GetRowUnit(theRow); + if(aUnit.size()>0) { aTitle += SEPARATOR; aTitle += aUnit; } - myRows->SetValue(theRow, aTitle); + myRows[theRow-1] = 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) +void SALOMEDSImpl_AttributeTableOfString::SetRowUnit(const int theRow, + const std::string& theUnit) { CheckLocked(); Backup(); - TCollection_ExtendedString aTitle = GetRowTitle(theRow); + std::string aTitle = GetRowTitle(theRow); aTitle += SEPARATOR; aTitle += theUnit; - myRows->SetValue(theRow, aTitle); + myRows[theRow-1] = aTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfString::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) +void SALOMEDSImpl_AttributeTableOfString::SetRowUnits(const vector& 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)); + if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theUnits.size(), i; + for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]); } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowUnits() +vector 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))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; i& 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)); + if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows"); + int aLength = theTitles.size(), i; + for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowTitles() +vector 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))); + vector aSeq; + int aLength = myRows.size(), i; + for(i=0; iValue(theRow)); + return getTitle(myRows[theRow-1]); } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetRowUnit(const Standard_Integer theRow) const +std::string SALOMEDSImpl_AttributeTableOfString::GetRowUnit(const int theRow) const { - return getUnit(myRows->Value(theRow)); + return getUnit(myRows[theRow-1]); } -void SALOMEDSImpl_AttributeTableOfString::SetRowData(const Standard_Integer theRow, - const Handle(TColStd_HSequenceOfExtendedString)& theData) +void SALOMEDSImpl_AttributeTableOfString::SetRowData(const int theRow, + const vector& theData) { CheckLocked(); - if(theData->Length() > myNbColumns) SetNbColumns(theData->Length()); + if(theData.size() > myNbColumns) SetNbColumns(theData.size()); Backup(); - while (myRows->Length() < theRow) { // append new row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append new row titles + myRows.push_back(std::string("")); } - Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length(); + int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(aShift + i, theData->Value(i)); + myTable[aShift + i] = theData[i-1]; } if(theRow > myNbRows) myNbRows = theRow; @@ -202,7 +194,7 @@ void SALOMEDSImpl_AttributeTableOfString::SetRowData(const Standard_Integer theR SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -void SALOMEDSImpl_AttributeTableOfString::SetTitle(const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfString::SetTitle(const std::string& theTitle) { CheckLocked(); Backup(); @@ -211,42 +203,42 @@ void SALOMEDSImpl_AttributeTableOfString::SetTitle(const TCollection_ExtendedStr SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetTitle() const +std::string SALOMEDSImpl_AttributeTableOfString::GetTitle() const { return myTitle; } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowData(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfString::GetRowData(const int theRow) { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString(); - Standard_Integer i, aShift = (theRow-1)*myNbColumns; + vector aSeq; + int i, aShift = (theRow-1)*myNbColumns; for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift+i)) - aSeq->Append(myTable.Find(aShift+i)); + if(myTable.find(aShift+i) != myTable.end()) + aSeq.push_back(myTable[aShift+i]); else - aSeq->Append(0.); + aSeq.push_back(""); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const Standard_Integer theColumn, - const Handle(TColStd_HSequenceOfExtendedString)& theData) +void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const int theColumn, + const vector& theData) { CheckLocked(); if(theColumn > myNbColumns) SetNbColumns(theColumn); Backup(); - Standard_Integer i, aLength = theData->Length(); + int i, aLength = theData.size(); for(i = 1; i <= aLength; i++) { - myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i)); + myTable[myNbColumns*(i-1)+theColumn] = theData[i-1]; } if(aLength > myNbRows) { myNbRows = aLength; - while (myRows->Length() < myNbRows) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < myNbRows) { // append empty row titles + myRows.push_back(std::string("")); } } @@ -254,82 +246,82 @@ void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const Standard_Integer t } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetColumnData(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfString::GetColumnData(const int theColumn) { - Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString; + vector aSeq; - Standard_Integer i, anIndex; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1) + theColumn; - if(myTable.IsBound(anIndex)) - aSeq->Append(myTable.Find(anIndex)); + if(myTable.find(anIndex) != myTable.end()) + aSeq.push_back(myTable[anIndex]); else - aSeq->Append(0.); + aSeq.push_back(""); } return aSeq; } -void SALOMEDSImpl_AttributeTableOfString::SetColumnTitle(const Standard_Integer theColumn, - const TCollection_ExtendedString& theTitle) +void SALOMEDSImpl_AttributeTableOfString::SetColumnTitle(const int theColumn, + const std::string& theTitle) { CheckLocked(); Backup(); - while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString("")); - myCols->SetValue(theColumn,theTitle); + while(myCols.size() < theColumn) myCols.push_back(std::string("")); + myCols[theColumn-1] = theTitle; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetColumnTitle(const Standard_Integer theColumn) const +std::string SALOMEDSImpl_AttributeTableOfString::GetColumnTitle(const int theColumn) const { - if(myCols.IsNull()) return ""; - if(myCols->Length() < theColumn) return ""; - return myCols->Value(theColumn); + if(myCols.empty()) return ""; + if(myCols.size() < theColumn) return ""; + return myCols[theColumn-1]; } -void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) +void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const vector& 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)); + if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns"); + int aLength = theTitles.size(), i; + for(i = 0; i < aLength; i++) myCols[i] = theTitles[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } -Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetColumnTitles() +vector 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)); + vector aSeq; + int aLength = myCols.size(), i; + for(i=0; i myNbColumns) SetNbColumns(theColumn); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - myTable.Bind(anIndex, theValue); + int anIndex = (theRow-1)*myNbColumns + theColumn; + myTable[anIndex] = theValue; if(theRow > myNbRows) { - while (myRows->Length() < theRow) { // append empty row titles - myRows->Append(TCollection_ExtendedString("")); + while (myRows.size() < theRow) { // append empty row titles + myRows.push_back(std::string("")); } myNbRows = theRow; } @@ -337,42 +329,42 @@ void SALOMEDSImpl_AttributeTableOfString::PutValue(const TCollection_ExtendedStr 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) +bool SALOMEDSImpl_AttributeTableOfString::HasValue(const int theRow, + const int theColumn) { - if(theRow > myNbRows || theRow < 1) return Standard_False; - if(theColumn > myNbColumns || theColumn < 1) return Standard_False; + if(theRow > myNbRows || theRow < 1) return false; + if(theColumn > myNbColumns || theColumn < 1) return false; - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - return myTable.IsBound(anIndex); + int anIndex = (theRow-1)*myNbColumns + theColumn; + return (myTable.find(anIndex) != myTable.end()); } -TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetValue(const Standard_Integer theRow, - const Standard_Integer theColumn) +std::string SALOMEDSImpl_AttributeTableOfString::GetValue(const int theRow, + const int theColumn) { - if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index"); - if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index"); + if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index"); + if(theColumn > myNbColumns || theColumn < 1) throw DFexception("Invalid cell index"); - Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn; - if(myTable.IsBound(anIndex)) return myTable.Find(anIndex); + int anIndex = (theRow-1)*myNbColumns + theColumn; + if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex]; - Standard_Failure::Raise("Invalid cell index"); - return 0.; + throw DFexception("Invalid cell index"); + return ""; } -const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::ID() const +const std::string& SALOMEDSImpl_AttributeTableOfString::ID() const { return GetID(); } -void SALOMEDSImpl_AttributeTableOfString::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeTableOfString::Restore(DF_Attribute* with) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(with); + int anIndex; + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(with); - myTable.Clear(); - myCols->Clear(); - myRows->Clear(); + myTable.clear(); + myCols.clear(); + myRows.clear(); myTable = aTable->myTable; myNbRows = aTable->myNbRows; @@ -380,26 +372,25 @@ void SALOMEDSImpl_AttributeTableOfString::Restore(const Handle(TDF_Attribute)& w myTitle = aTable->myTitle; for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++) - myRows->Append(aTable->GetRowTitle(anIndex)); + myRows.push_back(aTable->GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++) - myCols->Append(aTable->GetColumnTitle(anIndex)); + myCols.push_back(aTable->GetColumnTitle(anIndex)); } -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfString::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeTableOfString::NewEmpty() const { return new SALOMEDSImpl_AttributeTableOfString(); } -void SALOMEDSImpl_AttributeTableOfString::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)&) const +void SALOMEDSImpl_AttributeTableOfString::Paste(DF_Attribute* into) { - Standard_Integer anIndex; - Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(into); + int anIndex; + SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast(into); - aTable->myTable.Clear(); - aTable->myCols->Clear(); - aTable->myRows->Clear(); + aTable->myTable.clear(); + aTable->myCols.clear(); + aTable->myRows.clear(); aTable->myTable = myTable; aTable->myTitle = myTitle; @@ -407,32 +398,32 @@ void SALOMEDSImpl_AttributeTableOfString::Paste(const Handle(TDF_Attribute)& int aTable->myNbColumns = myNbColumns; for(anIndex = 1; anIndex <= GetNbRows();anIndex++) - aTable->myRows->Append(GetRowTitle(anIndex)); + aTable->myRows.push_back(GetRowTitle(anIndex)); for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++) - aTable->myCols->Append(GetColumnTitle(anIndex)); + aTable->myCols.push_back(GetColumnTitle(anIndex)); } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetRowIndices(const Standard_Integer theRow) +vector SALOMEDSImpl_AttributeTableOfString::GetSetRowIndices(const int theRow) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, aShift = myNbColumns*(theRow-1); + int i, aShift = myNbColumns*(theRow-1); for(i = 1; i <= myNbColumns; i++) { - if(myTable.IsBound(aShift + i)) aSeq->Append(i); + if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i); } return aSeq; } -Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetColumnIndices(const Standard_Integer theColumn) +vector SALOMEDSImpl_AttributeTableOfString::GetSetColumnIndices(const int theColumn) { - Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + vector aSeq; - Standard_Integer i, anIndex; + int i, anIndex; for(i = 1; i <= myNbRows; i++) { anIndex = myNbColumns*(i-1)+theColumn; - if(myTable.IsBound(anIndex)) aSeq->Append(i); + if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i); } return aSeq; @@ -440,58 +431,60 @@ Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetCol -void SALOMEDSImpl_AttributeTableOfString::ConvertToString(ostrstream& theStream) +string SALOMEDSImpl_AttributeTableOfString::Save() { + ostrstream theStream; int i, j, l; //Title - l = myTitle.Length(); + l = myTitle.size(); theStream << l << "\n"; - for(i=1; i<=l; i++) - theStream << myTitle.Value(i) << "\n"; + for(i=0; iValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jValue(i).Length(); + for(i=0; iValue(i).Value(j) << "\n"; + for(j=0; jsecond.size()) { // check empty string in the value table + theStream << p->first << "\n"; + unsigned long aValueSize = p->second.size(); theStream<second.c_str(),aValueSize); theStream<<"\n"; } else { // write index only of kind: "0key"; "05", for an example - theStream << "0" << anIterator.Key() << "\n"; + theStream << "0" << p->first << "\n"; } } - return; + string aString((char*)theStream.rdbuf()->str()); + return aString; } -bool SALOMEDSImpl_AttributeTableOfString::RestoreFromString(istrstream& theStream) +void SALOMEDSImpl_AttributeTableOfString::Load(const string& value) { + istrstream theStream(value.c_str(), strlen(value.c_str())); Backup(); theStream.seekg(0, ios::end); @@ -501,60 +494,60 @@ bool SALOMEDSImpl_AttributeTableOfString::RestoreFromString(istrstream& theStrea int i, j, l; char *aValueString = new char[aSize]; - Standard_ExtCharacter anExtChar; - TCollection_ExtendedString aStr; + char anExtChar; + std::string aStr; //Title theStream >> l; - myTitle = TCollection_ExtendedString(l, 0); - for(i=1; i<=l; i++) { + myTitle = std::string(l, 0); + for(i=0; i> anExtChar; - myTitle.SetValue(i, anExtChar); + myTitle[i] = anExtChar; } //Nb rows theStream >> myNbRows; //Rows titles - myRows->Clear(); - for(i=1; i<=myNbRows; i++) { + myRows.clear(); + for(i=0; i> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myRows->Append(aStr); + myRows.push_back(aStr); } //Nb columns theStream >> myNbColumns; //Columns titles - myCols->Clear(); - for(i=1; i<=myNbColumns; i++) { + myCols.clear(); + for(i=0; i> l; - aStr = TCollection_ExtendedString(l,0); - for(j=1; j<=l; j++) { + aStr = std::string(l,0); + for(j=0; j> anExtChar; - aStr.SetValue(j, anExtChar); + aStr[j] = anExtChar; } - myCols->Append(aStr); + myCols.push_back(aStr); } //Restore the table values - TCollection_AsciiString aValue; + string aValue; theStream >> l; - myTable.Clear(); + myTable.clear(); theStream.getline(aValueString,aSize,'\n'); for(i=1; i<=l; i++) { - Standard_Integer aKey; + int aKey; theStream.getline(aValueString,aSize,'\n'); aValue = aValueString; - aKey = aValue.IntegerValue(); - if (aValue.Value(1) == '0') + aKey = atoi(aValue.c_str()); + if (aValue[0] == '0') aValue = ""; else { unsigned long aValueSize; @@ -564,22 +557,7 @@ bool SALOMEDSImpl_AttributeTableOfString::RestoreFromString(istrstream& theStrea theStream.read(aValueString, 1); // an '\n' omitting aValue = aValueString; } - myTable.Bind(aKey, aValue); + myTable[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); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.hxx index 68725ed3a..0a4da3185 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.hxx @@ -11,87 +11,66 @@ #ifndef _SALOMEDSImpl_AttributeTableOfString_HeaderFile #define _SALOMEDSImpl_AttributeTableOfString_HeaderFile -#include -#include -#include -#include +#include "DF_Label.hxx" +#include "DF_Attribute.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); - - -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute ) - -#include -#include -#include -#include -#include -#include -#include - -typedef NCollection_DataMap DataMapOfIntegerString; +#include +#include +#include class SALOMEDSImpl_AttributeTableOfString : 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_AttributeTableOfString Set(const TDF_Label& label) ; +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeTableOfString* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeTableOfString(); -Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns); -Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetTitle() const; -Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfExtendedString)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetRowData(const Standard_Integer theRow) ; -Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ; -Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const; -Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits(); -Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ; -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles(); -Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const; -Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfExtendedString)& theData) ; -Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetColumnData(const Standard_Integer theColumn) ; -Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ; -Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const; -Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles); -Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles(); -Standard_EXPORT Standard_Integer GetNbRows() const; -Standard_EXPORT Standard_Integer GetNbColumns() const; - -Standard_EXPORT void PutValue(const TCollection_ExtendedString& theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -Standard_EXPORT TCollection_ExtendedString GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ; -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 Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow); -Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn); - -Standard_EXPORT void ConvertToString(ostrstream& theStream); -Standard_EXPORT bool RestoreFromString(istrstream& theStream); +Standard_EXPORT void SetNbColumns(const int theNbColumns); +Standard_EXPORT void SetTitle(const std::string& theTitle) ; +Standard_EXPORT std::string GetTitle() const; +Standard_EXPORT void SetRowData(const int theRow,const std::vector& theData) ; +Standard_EXPORT std::vector GetRowData(const int theRow) ; +Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ; +Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ; +Standard_EXPORT std::string GetRowUnit(const int theRow) const; +Standard_EXPORT void SetRowUnits(const std::vector& theUnits) ; +Standard_EXPORT std::vector GetRowUnits(); +Standard_EXPORT void SetRowTitles(const std::vector& theTitles) ; +Standard_EXPORT std::vector GetRowTitles(); +Standard_EXPORT std::string GetRowTitle(const int theRow) const; +Standard_EXPORT void SetColumnData(const int theColumn,const std::vector& theData) ; +Standard_EXPORT std::vector GetColumnData(const int theColumn) ; +Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ; +Standard_EXPORT std::string GetColumnTitle(const int theColumn) const; +Standard_EXPORT void SetColumnTitles(const std::vector& theTitles); +Standard_EXPORT std::vector GetColumnTitles(); +Standard_EXPORT int GetNbRows() const; +Standard_EXPORT int GetNbColumns() const; + +Standard_EXPORT void PutValue(const std::string& theValue,const int theRow,const int theColumn) ; +Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ; +Standard_EXPORT std::string GetValue(const int theRow,const int theColumn) ; +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); + +Standard_EXPORT std::vector GetSetRowIndices(const int theRow); +Standard_EXPORT std::vector GetSetColumnIndices(const int theColumn); Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfString() {} private: -DataMapOfIntegerString myTable; -TCollection_ExtendedString myTitle; -Handle_TColStd_HSequenceOfExtendedString myRows; -Handle_TColStd_HSequenceOfExtendedString myCols; -Standard_Integer myNbRows; -Standard_Integer myNbColumns; - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfString ) +std::map myTable; +std::string myTitle; +std::vector myRows; +std::vector myCols; +int myNbRows; +int myNbColumns; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.cxx index 20e86c4c9..8b0938bde 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.cxx @@ -25,24 +25,18 @@ #include "SALOMEDSImpl_AttributeTarget.hxx" #include "SALOMEDSImpl_AttributeReference.hxx" #include "SALOMEDSImpl_Study.hxx" -#include -#include -#include 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 () +const std::string& SALOMEDSImpl_AttributeTarget::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeTargetID ("12837197-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTargetID ("12837197-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTargetID; } @@ -52,10 +46,10 @@ const Standard_GUID& SALOMEDSImpl_AttributeTarget::GetID () //purpose : //======================================================================= -Handle(SALOMEDSImpl_AttributeTarget) SALOMEDSImpl_AttributeTarget::Set (const TDF_Label& L) +SALOMEDSImpl_AttributeTarget* SALOMEDSImpl_AttributeTarget::Set (const DF_Label& L) { - Handle(SALOMEDSImpl_AttributeTarget) A; - if (!L.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),A)) { + SALOMEDSImpl_AttributeTarget* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeTarget*)L.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) { A = new SALOMEDSImpl_AttributeTarget(); L.AddAttribute(A); } @@ -72,7 +66,7 @@ SALOMEDSImpl_AttributeTarget::SALOMEDSImpl_AttributeTarget() { } -void SALOMEDSImpl_AttributeTarget::SetRelation(const TCollection_ExtendedString& theRelation) +void SALOMEDSImpl_AttributeTarget::SetRelation(const std::string& theRelation) { CheckLocked(); if(myRelation == theRelation) return; @@ -87,15 +81,14 @@ void SALOMEDSImpl_AttributeTarget::SetRelation(const TCollection_ExtendedString& //function : Add //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTarget::Add(const Handle(SALOMEDSImpl_SObject)& theSO) +void SALOMEDSImpl_AttributeTarget::Add(const 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); + DF_Label aRefLabel = theSO.GetLabel(); + SALOMEDSImpl_AttributeReference* aReference; + if ((aReference=(SALOMEDSImpl_AttributeReference*)aRefLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { + for(int i = 0, len = myVariables.size(); iLabel() == aRefLabel) return; //BugID: PAL6192 + myVariables.push_back(aReference); } SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved @@ -105,15 +98,13 @@ void SALOMEDSImpl_AttributeTarget::Add(const Handle(SALOMEDSImpl_SObject)& theSO //function : Get //purpose : //======================================================================= -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_AttributeTarget::Get() +vector SALOMEDSImpl_AttributeTarget::Get() { - Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + vector aSeq; + + for(int i = 0, len = myVariables.size(); iLabel())); - TDF_ListIteratorOfAttributeList anIter(GetVariables()); - for(;anIter.More();anIter.Next()) { - const TDF_Label& aLabel = anIter.Value()->Label(); - aSeq->Append( SALOMEDSImpl_Study::SObject(aLabel)); - } return aSeq; } @@ -121,17 +112,20 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_AttributeTarget::Get() //function : Remove //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTarget::Remove(const Handle(SALOMEDSImpl_SObject)& theSO) +void SALOMEDSImpl_AttributeTarget::Remove(const 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; - } - } + DF_Label aRefLabel = theSO.GetLabel(); + + vector va; + for(int i = 0, len = myVariables.size(); iLabel(); + if(myVariables[i]->Label() == aRefLabel) continue; + va.push_back(myVariables[i]); + } + + myVariables.clear(); + myVariables = va; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -140,21 +134,19 @@ void SALOMEDSImpl_AttributeTarget::Remove(const Handle(SALOMEDSImpl_SObject)& th //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTarget::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeTarget::ID () const { return GetID(); } //======================================================================= //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTarget::Restore(const Handle(TDF_Attribute)& With) +void SALOMEDSImpl_AttributeTarget::Restore(DF_Attribute* With) { - Handle(SALOMEDSImpl_AttributeTarget) REL = Handle(SALOMEDSImpl_AttributeTarget)::DownCast (With); + SALOMEDSImpl_AttributeTarget* REL = dynamic_cast(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); + myVariables.clear(); + for (int i = 0, len = REL->myVariables.size(); imyVariables[i]); } } @@ -162,7 +154,7 @@ void SALOMEDSImpl_AttributeTarget::Restore(const Handle(TDF_Attribute)& With) //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTarget::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeTarget::NewEmpty() const { return new SALOMEDSImpl_AttributeTarget(); } @@ -171,15 +163,12 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeTarget::NewEmpty() const //function : Paste //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTarget::Paste(const Handle(TDF_Attribute)& Into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeTarget::Paste(DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeTarget) REL = Handle(SALOMEDSImpl_AttributeTarget)::DownCast (Into); + SALOMEDSImpl_AttributeTarget* REL = dynamic_cast(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); - } + REL->myVariables.clear(); + for (int i = 0, len = myVariables.size(); imyVariables.push_back(myVariables[i]); + } } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx index 1ae8c0b0d..5c4bb4f71 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTarget.hxx @@ -24,49 +24,34 @@ #ifndef _SALOMEDSImpl_AttributeTarget_HeaderFile #define _SALOMEDSImpl_AttributeTarget_HeaderFile -#include -#include -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #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; +std::string myRelation; +std::vector myVariables; public: -Standard_EXPORT static const Standard_GUID& GetID() ; -Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTarget Set(const TDF_Label& label) ; +Standard_EXPORT static const std::string& GetID() ; +Standard_EXPORT static SALOMEDSImpl_AttributeTarget* Set(const DF_Label& label) ; Standard_EXPORT SALOMEDSImpl_AttributeTarget(); -Standard_EXPORT void Add(const Handle(SALOMEDSImpl_SObject)& theSO); -Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Get(); -Standard_EXPORT void 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 void Add(const SALOMEDSImpl_SObject& theSO); +Standard_EXPORT std::vector Get(); +Standard_EXPORT void Remove(const SALOMEDSImpl_SObject& theSO); +Standard_EXPORT std::string GetRelation() { return myRelation; } +Standard_EXPORT void SetRelation(const std::string& theRelation); +Standard_EXPORT std::vector& GetVariables() { return myVariables; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeTarget() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTarget ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx index 8250ff194..cf53370db 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.cxx @@ -23,21 +23,17 @@ #include "SALOMEDSImpl_AttributeTextColor.hxx" -#include 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 () +const std::string& SALOMEDSImpl_AttributeTextColor::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeTextColorID ("12837189-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTextColorID ("12837189-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTextColorID; } @@ -49,22 +45,25 @@ const Standard_GUID& SALOMEDSImpl_AttributeTextColor::GetID () SALOMEDSImpl_AttributeTextColor::SALOMEDSImpl_AttributeTextColor() :SALOMEDSImpl_GenericAttribute("AttributeTextColor") { - myValue = new TColStd_HArray1OfReal(1, 3, 0.); + myValue.clear(); + myValue.push_back(0.); + myValue.push_back(0.); + myValue.push_back(0.); } //======================================================================= //function : SetTextColor //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextColor::SetTextColor(const Standard_Real R, const Standard_Real G, const Standard_Real B) +void SALOMEDSImpl_AttributeTextColor::SetTextColor(const double& R, const double& G, const double& B) { CheckLocked(); - if(myValue.IsNull()) return; + Backup(); - myValue->SetValue(1, R); - myValue->SetValue(2, G); - myValue->SetValue(3, B); + myValue[0] = R; + myValue[1] = G; + myValue[2] = B; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -73,7 +72,7 @@ void SALOMEDSImpl_AttributeTextColor::SetTextColor(const Standard_Real R, const //function : TextColor //purpose : //======================================================================= -Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextColor::TextColor() +vector SALOMEDSImpl_AttributeTextColor::TextColor() { return myValue; } @@ -82,12 +81,12 @@ Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextColor::TextColor() //function : ChangeArray //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextColor::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray) +void SALOMEDSImpl_AttributeTextColor::ChangeArray(const vector& newArray) { Backup(); - for(int i = 1; i <= 3; i++) - myValue->SetValue(i, newArray->Value(i)); + for(int i = 0; i < 3; i++) + myValue[i] = newArray[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -97,7 +96,7 @@ void SALOMEDSImpl_AttributeTextColor::ChangeArray(const Handle(TColStd_HArray1Of //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID(); } +const std::string& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID(); } //======================================================================= @@ -105,7 +104,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextColor::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeTextColor::NewEmpty () const { return new SALOMEDSImpl_AttributeTextColor(); } @@ -115,10 +114,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextColor::NewEmpty () const //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextColor::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeTextColor::Restore(DF_Attribute* with) { - Handle(TColStd_HArray1OfReal) s = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast (with)->TextColor (); - ChangeArray(s); + ChangeArray( dynamic_cast(with)->TextColor ()); return; } @@ -127,30 +125,29 @@ void SALOMEDSImpl_AttributeTextColor::Restore(const Handle(TDF_Attribute)& with) //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextColor::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeTextColor::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeTextColor)::DownCast (into)->ChangeArray (myValue); + dynamic_cast(into)->ChangeArray (myValue); } -TCollection_AsciiString SALOMEDSImpl_AttributeTextColor::Save() +string 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); + sprintf(Val, "%f %f %f", (float)myValue[0], + (float)myValue[1], + (float)myValue[2]); + string ret(Val); delete Val; return ret; } -void SALOMEDSImpl_AttributeTextColor::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeTextColor::Load(const string& 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); + sscanf(value.c_str(), "%f %f %f", &r, &g, &b); + myValue[0] = r; + myValue[1] = g; + myValue[2] = b; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.hxx index 21efa7e8b..a0e9f50d7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextColor.hxx @@ -24,41 +24,31 @@ #ifndef _SALOMEDSImpl_AttributeTextColor_HeaderFile #define _SALOMEDSImpl_AttributeTextColor_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include +#include #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; + std::vector 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 virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT static const std::string& 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 const std::string& ID() const; +Standard_EXPORT void SetTextColor(const double& R, const double& G, const double& B); +Standard_EXPORT std::vector TextColor(); +Standard_EXPORT void ChangeArray(const std::vector& newArray); +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste( DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeTextColor() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTextColor ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx index cf9449d09..1661a6cc5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.cxx @@ -23,21 +23,17 @@ #include "SALOMEDSImpl_AttributeTextHighlightColor.hxx" -#include 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 () +const std::string& SALOMEDSImpl_AttributeTextHighlightColor::GetID () { - static Standard_GUID SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F"); + static std::string SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F"); return SALOMEDSImpl_AttributeTextHighlightColorID; } @@ -50,7 +46,10 @@ const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::GetID () SALOMEDSImpl_AttributeTextHighlightColor::SALOMEDSImpl_AttributeTextHighlightColor() :SALOMEDSImpl_GenericAttribute("AttributeTextHighlightColor") { - myValue = new TColStd_HArray1OfReal(1, 3, 0.); + myValue.clear(); + myValue.push_back(0.0); + myValue.push_back(0.0); + myValue.push_back(0.0); } //======================================================================= @@ -58,24 +57,23 @@ SALOMEDSImpl_AttributeTextHighlightColor::SALOMEDSImpl_AttributeTextHighlightCol //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::ID () const { return GetID(); } +const std::string& 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) +void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const double& R, + const double& G, + const double& B) { CheckLocked(); - if(myValue.IsNull()) return; Backup(); - myValue->SetValue(1, R); - myValue->SetValue(2, G); - myValue->SetValue(3, B); + myValue[0] = R; + myValue[1] = G; + myValue[2] = B; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -84,7 +82,7 @@ void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const Stand //function : TextHighlightColor //purpose : //======================================================================= -Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor() +vector SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor() { return myValue; } @@ -93,12 +91,12 @@ Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextHighlightColor::TextHigh //function : ChangeArray //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray) +void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const vector& newArray) { Backup(); - for(int i = 1; i <= 3; i++) - myValue->SetValue(i, newArray->Value(i)); + for(int i = 0; i < 3; i++) + myValue[i] = newArray[i]; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -108,7 +106,7 @@ void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const Handle(TColStd_ //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const { return new SALOMEDSImpl_AttributeTextHighlightColor(); } @@ -118,10 +116,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () cons //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextHighlightColor::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeTextHighlightColor::Restore(DF_Attribute* with) { - Handle(TColStd_HArray1OfReal) s = Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast (with)->TextHighlightColor (); - ChangeArray(s); + ChangeArray(dynamic_cast(with)->TextHighlightColor());; return; } @@ -130,29 +127,28 @@ void SALOMEDSImpl_AttributeTextHighlightColor::Restore(const Handle(TDF_Attribut //purpose : //======================================================================= -void SALOMEDSImpl_AttributeTextHighlightColor::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& ) const +void SALOMEDSImpl_AttributeTextHighlightColor::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast (into)->ChangeArray (myValue); + dynamic_cast(into)->ChangeArray (myValue); } -TCollection_AsciiString SALOMEDSImpl_AttributeTextHighlightColor::Save() +string 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); + sprintf(Val, "%f %f %f", (float)myValue[0], + (float)myValue[1], + (float)myValue[2]); + string ret(Val); delete Val; return ret; } -void SALOMEDSImpl_AttributeTextHighlightColor::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeTextHighlightColor::Load(const string& 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); + sscanf(value.c_str(), "%f %f %f", &r, &g, &b); + myValue[0] = r; + myValue[1] = g; + myValue[2] = b; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.hxx index ed54f4b12..d17e7f29c 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTextHighlightColor.hxx @@ -24,41 +24,31 @@ #ifndef _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile #define _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include +#include #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; + std::vector 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 virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT static const std::string& 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 void SetTextHighlightColor(const double& R, const double& G, const double& B); +Standard_EXPORT std::vector TextHighlightColor(); +Standard_EXPORT void ChangeArray(const std::vector& newArray); +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeTextHighlightColor() {} - -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTextHighlightColor ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx index 8bc31e415..dfcad3b58 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.cxx @@ -23,28 +23,12 @@ #include "SALOMEDSImpl_AttributeTreeNode.hxx" -#include -#include -#include -#include -#include -#include using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute ) - -static char* Entry(const TDF_Label& theLabel) +const std::string& SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID() { - 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"); + static std::string TreeNodeID ("0E1C36E6-379B-4d90-AC37-17A14310E648"); return TreeNodeID; } @@ -54,11 +38,11 @@ SALOMEDSImpl_AttributeTreeNode::SALOMEDSImpl_AttributeTreeNode() {} -Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Set (const TDF_Label& L, const Standard_GUID& ID) +SALOMEDSImpl_AttributeTreeNode* SALOMEDSImpl_AttributeTreeNode::Set (const DF_Label& L, const std::string& ID) { - Handle(SALOMEDSImpl_AttributeTreeNode) TN; + SALOMEDSImpl_AttributeTreeNode* TN = NULL; - if (!L.FindAttribute(ID,TN)) { + if (!(TN=(SALOMEDSImpl_AttributeTreeNode*)L.FindAttribute(ID))) { TN = new SALOMEDSImpl_AttributeTreeNode (); TN->SetTreeID(ID); L.AddAttribute(TN); @@ -71,7 +55,7 @@ Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Set (cons //TreeNode : ID //purpose : Returns GUID of the TreeNode //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::ID() const +const std::string& SALOMEDSImpl_AttributeTreeNode::ID() const { return myTreeID; } @@ -80,27 +64,24 @@ const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::ID() const //function : Append //purpose : Add as last child of me //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Append (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN) +bool SALOMEDSImpl_AttributeTreeNode::Append (SALOMEDSImpl_AttributeTreeNode* TN) { CheckLocked(); - if (!(TN->ID() == myTreeID) ) - Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID"); + if (!(TN->ID() == myTreeID)) throw DFexception("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID"); - if(TN->Label() == Label()) - Standard_Failure::Raise("Attempt of self linking"); + if(TN->Label() == Label()) throw DFexception("Attempt of self linking"); - Handle(SALOMEDSImpl_AttributeTreeNode) bid; - TN->SetNext(bid); // Deconnects from next. + TN->SetNext(NULL); // Deconnects from next. // Find the last if (!HasFirst()) { SetFirst(TN); - TN->SetPrevious(bid); // Deconnects from previous. + TN->SetPrevious(NULL); // Deconnects from previous. } else { - Handle(SALOMEDSImpl_AttributeTreeNode) Last = GetFirst(); - while (Last->HasNext()) { + SALOMEDSImpl_AttributeTreeNode* Last = GetFirst(); + while (Last && Last->HasNext()) { Last = Last->GetNext(); } Last->SetNext(TN); @@ -111,38 +92,35 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Append (const Handle(SALOMEDSIm SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved - return !TN.IsNull(); + return (TN); } //======================================================================= //function : Prepend //purpose : Add as first child of me //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Prepend (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN) +bool SALOMEDSImpl_AttributeTreeNode::Prepend (SALOMEDSImpl_AttributeTreeNode* TN) { CheckLocked(); - if (!(TN->ID() == myTreeID) ) - Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID"); + if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID"); - if(TN->Label() == Label()) - Standard_Failure::Raise("Attempt of self linking"); + if(TN->Label() == Label()) throw DFexception("Attempt of self linking"); - Handle(SALOMEDSImpl_AttributeTreeNode) bid; - TN->SetPrevious(bid); + TN->SetPrevious(NULL); if (HasFirst()) { TN->SetNext(GetFirst()); GetFirst()->SetPrevious(TN); } else { - TN->SetNext(bid); + TN->SetNext(NULL); } TN->SetFather(this); SetFirst(TN); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved - return !TN.IsNull(); + return (TN); } @@ -150,15 +128,13 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Prepend (const Handle(SALOMEDSI //function : InsertBefore //purpose : Inserts the TreeNode before me //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertBefore (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN) +bool SALOMEDSImpl_AttributeTreeNode::InsertBefore (SALOMEDSImpl_AttributeTreeNode* TN) { CheckLocked(); - if (!(TN->ID() == myTreeID) ) - Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID"); + if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID"); - if(TN->Label() == Label()) - Standard_Failure::Raise("Attempt of self linking"); + if(TN->Label() == Label()) throw DFexception("Attempt of self linking"); TN->SetFather(GetFather()); TN->SetPrevious(GetPrevious()); @@ -173,22 +149,20 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertBefore (const Handle(SALO SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved - return !TN.IsNull(); + return (TN); } //======================================================================= //function : InsertAfter //purpose : Inserts the TreeNode after me //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertAfter (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN) +bool SALOMEDSImpl_AttributeTreeNode::InsertAfter (SALOMEDSImpl_AttributeTreeNode* TN) { CheckLocked(); - if(TN->Label() == Label()) - Standard_Failure::Raise("Attempt of self linking"); + if(TN->Label() == Label()) throw DFexception("Attempt of self linking"); - if (!(TN->ID() == myTreeID) ) - Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID"); + if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID"); TN->SetFather(GetFather()); TN->SetPrevious(this); @@ -200,20 +174,19 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertAfter (const Handle(SALOM SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved - return !TN.IsNull(); + return (TN); } //======================================================================= //function : Remove //purpose : Removees the function from the function tree //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Remove () +bool SALOMEDSImpl_AttributeTreeNode::Remove () { CheckLocked(); - if (IsRoot()) return Standard_True; + if (IsRoot()) return true; - Handle(SALOMEDSImpl_AttributeTreeNode) bid; if (!HasPrevious()) GetFather()->SetFirst(GetNext()); else @@ -221,39 +194,39 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Remove () if (HasNext()) { if (HasPrevious()) GetNext()->SetPrevious(GetPrevious()); - else GetNext()->SetPrevious(bid); + else GetNext()->SetPrevious(NULL); } else { - if (HasPrevious()) GetPrevious()->SetNext(bid); + if (HasPrevious()) GetPrevious()->SetNext(NULL); } if (GetFather()->HasFirst()) { - if (Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(this) == GetFather()->GetFirst()) { + if (this == GetFather()->GetFirst()) { if (HasNext()) { GetFather()->SetFirst(GetNext()); } - else GetFather()->SetFirst(bid); + else GetFather()->SetFirst(NULL); } } - SetFather(bid); - SetNext(bid); - SetPrevious(bid); + SetFather(NULL); + SetNext(NULL); + SetPrevious(NULL); SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved - return Standard_True; + return true; } //======================================================================= //function : Depth //purpose : //======================================================================= -Standard_Integer SALOMEDSImpl_AttributeTreeNode::Depth () const +int SALOMEDSImpl_AttributeTreeNode::Depth () const { - Standard_Integer depth = 0; - Handle(SALOMEDSImpl_AttributeTreeNode) current = this; - while (current->HasFather()) { + int depth = 0; + SALOMEDSImpl_AttributeTreeNode* current = (SALOMEDSImpl_AttributeTreeNode*)this; + while (current) { depth++; current = current->GetFather(); } @@ -265,7 +238,7 @@ Standard_Integer SALOMEDSImpl_AttributeTreeNode::Depth () const //purpose : Finds or creates a TreeNode attribute with explicit ID // : a driver for it //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const Standard_GUID& explicitID) +void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const std::string& explicitID) { myTreeID = explicitID; @@ -277,7 +250,7 @@ void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const Standard_GUID& explicitID) //function : IsAscendant //purpose : //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsAscendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const +bool SALOMEDSImpl_AttributeTreeNode::IsAscendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const { return ofTN->IsDescendant(this); } @@ -287,14 +260,14 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsAscendant (const Handle(SALOM //purpose : //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsDescendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const +bool SALOMEDSImpl_AttributeTreeNode::IsDescendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const { - Handle(SALOMEDSImpl_AttributeTreeNode) current = this; - while (current->HasFather()) { - if (current->GetFather() == ofTN) return Standard_True; + SALOMEDSImpl_AttributeTreeNode* current = (SALOMEDSImpl_AttributeTreeNode*)this; + while (current) { + if (current->GetFather() == ofTN) return true; current = current->GetFather(); } - return Standard_False; + return false; } //======================================================================= @@ -302,7 +275,7 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsDescendant (const Handle(SALO //purpose : //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsFather (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const +bool SALOMEDSImpl_AttributeTreeNode::IsFather (const SALOMEDSImpl_AttributeTreeNode* ofTN) const { return (ofTN->GetFather() == this); } @@ -313,7 +286,7 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsFather (const Handle(SALOMEDS //purpose : //======================================================================= -Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsChild (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const +bool SALOMEDSImpl_AttributeTreeNode::IsChild (const SALOMEDSImpl_AttributeTreeNode* ofTN) const { return (myFather == ofTN); } @@ -323,23 +296,21 @@ Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsChild (const Handle(SALOMEDSI //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 +bool SALOMEDSImpl_AttributeTreeNode::IsRoot() const { - if (myFather.IsNull() && - myPrevious.IsNull() && - myNext.IsNull()) - return Standard_True; - return Standard_False; + if (!myFather && !myPrevious && !myNext) + return true; + return false; } //======================================================================= //TreeNode : Root //purpose : Returns the TreeNode which has no Father //======================================================================= -Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Root() const +SALOMEDSImpl_AttributeTreeNode* SALOMEDSImpl_AttributeTreeNode::Root() const { - Handle(SALOMEDSImpl_AttributeTreeNode) O = this; - while (O->HasFather()) + SALOMEDSImpl_AttributeTreeNode* O = (SALOMEDSImpl_AttributeTreeNode*)this; + while (O && O->HasFather()) O = O->GetFather(); return O; } @@ -348,11 +319,11 @@ Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Root() co //TreeNode : SetFather //purpose : Sets the TreeNode F as Father of me //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::SetFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& F) +void SALOMEDSImpl_AttributeTreeNode::SetFather(const SALOMEDSImpl_AttributeTreeNode* F) { CheckLocked(); Backup(); - myFather = F; + myFather = (SALOMEDSImpl_AttributeTreeNode*)F; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -361,11 +332,11 @@ void SALOMEDSImpl_AttributeTreeNode::SetFather(const Handle(SALOMEDSImpl_Attribu //TreeNode : SetNext //purpose : Sets the TreeNode F next to me //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::SetNext(const Handle(SALOMEDSImpl_AttributeTreeNode)& F) +void SALOMEDSImpl_AttributeTreeNode::SetNext(const SALOMEDSImpl_AttributeTreeNode* F) { CheckLocked(); Backup(); - myNext = F; + myNext = (SALOMEDSImpl_AttributeTreeNode*)F; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -375,11 +346,11 @@ void SALOMEDSImpl_AttributeTreeNode::SetNext(const Handle(SALOMEDSImpl_Attribute //TreeNode : SetPrevious //purpose : Sets the TreeNode F previous to me //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const Handle(SALOMEDSImpl_AttributeTreeNode)& F) +void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const SALOMEDSImpl_AttributeTreeNode* F) { CheckLocked(); Backup(); - myPrevious = F; + myPrevious = (SALOMEDSImpl_AttributeTreeNode*)F; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -388,11 +359,11 @@ void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const Handle(SALOMEDSImpl_Attri //TreeNode : SetFirst //purpose : Sets the TreeNode F as first in the TreeNode tree //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::SetFirst(const Handle(SALOMEDSImpl_AttributeTreeNode)& F) +void SALOMEDSImpl_AttributeTreeNode::SetFirst(const SALOMEDSImpl_AttributeTreeNode* F) { CheckLocked(); Backup(); - myFirst = F; + myFirst = (SALOMEDSImpl_AttributeTreeNode*)F; SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved } @@ -400,73 +371,37 @@ void SALOMEDSImpl_AttributeTreeNode::SetFirst(const Handle(SALOMEDSImpl_Attribut //======================================================================= //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); + if (myPrevious) { + myPrevious->SetNext(this); + } + else if (myFather) { + myFather->SetFirst(this); + } + if (myNext) { + 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) +void SALOMEDSImpl_AttributeTreeNode::Restore(DF_Attribute* other) { - Handle(SALOMEDSImpl_AttributeTreeNode) F = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(other); + SALOMEDSImpl_AttributeTreeNode* F = dynamic_cast(other); myFather = F->myFather; myPrevious = F->myPrevious; myNext = F->myNext; @@ -479,28 +414,13 @@ void SALOMEDSImpl_AttributeTreeNode::Restore(const Handle(TDF_Attribute)& other) //purpose : Method for Copy mechanism //======================================================================= -void SALOMEDSImpl_AttributeTreeNode::Paste(const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeTreeNode::Paste(DF_Attribute* into) { - 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); + SALOMEDSImpl_AttributeTreeNode* intof = dynamic_cast(into); + intof->SetFather(myFather); + intof->SetNext(myNext); + intof->SetPrevious(myPrevious); + intof->SetFirst(myFirst); intof->SetTreeID(myTreeID); } @@ -509,69 +429,52 @@ void SALOMEDSImpl_AttributeTreeNode::Paste(const Handle(TDF_Attribute)& into, //purpose : Returns new empty TreeNode attribute //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeTreeNode::NewEmpty() const +DF_Attribute* SALOMEDSImpl_AttributeTreeNode::NewEmpty() const { - Handle(SALOMEDSImpl_AttributeTreeNode) T = new SALOMEDSImpl_AttributeTreeNode(); + 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() +string SALOMEDSImpl_AttributeTreeNode::Type() { char* aNodeName = new char[60]; - char aGUID[40]; - ID().ToCString(aGUID); - sprintf(aNodeName, "AttributeTreeNodeGUID%s",aGUID); - TCollection_AsciiString ret(aNodeName); + sprintf(aNodeName, "AttributeTreeNodeGUID%s", ID().c_str()); + string ret(aNodeName); delete aNodeName; return ret; } -TCollection_AsciiString SALOMEDSImpl_AttributeTreeNode::Save() +string SALOMEDSImpl_AttributeTreeNode::Save() { - TCollection_AsciiString aFather, aPrevious, aNext, aFirst; + string 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 = "!"; + if (HasFather()) aFather = GetFather()->Label().Entry(); else aFather = "!"; + if (HasPrevious()) aPrevious = GetPrevious()->Label().Entry(); else aPrevious = "!"; + if (HasNext()) aNext = GetNext()->Label().Entry(); else aNext = "!"; + if (HasFirst()) aFirst = GetFirst()->Label().Entry(); else aFirst = "!"; int aLength = 4; - aLength += aFather.Length() + aPrevious.Length() + aNext.Length() + aFirst.Length(); + aLength += aFather.size() + aPrevious.size() + aNext.size() + aFirst.size(); char* aResult = new char[aLength]; - sprintf(aResult, "%s %s %s %s", aFather.ToCString(), aPrevious.ToCString(), aNext.ToCString(), aFirst.ToCString()); - TCollection_AsciiString ret(aResult); + sprintf(aResult, "%s %s %s %s", aFather.c_str(), aPrevious.c_str(), aNext.c_str(), aFirst.c_str()); + string ret(aResult); delete aResult; return ret; } -void SALOMEDSImpl_AttributeTreeNode::Load(const TCollection_AsciiString& value) +void SALOMEDSImpl_AttributeTreeNode::Load(const string& value) { - Handle(TDF_Data) DF = Label().Data(); - - char* aCopy = (char*)value.ToCString(); + char* aCopy = (char*)value.c_str(); char* adr = strtok(aCopy, " "); - TDF_Label aLabel; - Handle(SALOMEDSImpl_AttributeTreeNode) aDepNode; + DF_Label aLabel; + SALOMEDSImpl_AttributeTreeNode* aDepNode = NULL; if (adr && adr[0] != '!') { - TDF_Tool::Label(DF, adr, aLabel, 1); - if (!aLabel.FindAttribute(ID(), aDepNode)) + aLabel = DF_Label::Label(Label(), adr, true); + if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID()))) aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID()); SetFather(aDepNode); @@ -579,24 +482,24 @@ void SALOMEDSImpl_AttributeTreeNode::Load(const TCollection_AsciiString& value) adr = strtok(NULL, " "); if (adr && adr[0] != '!') { - TDF_Tool::Label(DF, adr, aLabel, 1); - if (!aLabel.FindAttribute(ID(), aDepNode)) + aLabel = DF_Label::Label(Label(), adr, true); + if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID()))) 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)) + aLabel = DF_Label::Label(Label(), adr, true); + if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID()))) 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)) + aLabel = DF_Label::Label(Label(), adr, true); + if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID()))) aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID()); SetFirst(aDepNode); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.hxx index 509a3d529..88d6a6b0d 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTreeNode.hxx @@ -24,87 +24,69 @@ #ifndef _SALOMEDSImpl_AttributeTreeNode_HeaderFile #define _SALOMEDSImpl_AttributeTreeNode_HeaderFile -#include -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #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 const static std::string& GetDefaultTreeID(); +Standard_EXPORT static SALOMEDSImpl_AttributeTreeNode* Set(const DF_Label& L, const std::string& 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 ) +Standard_EXPORT void SetFather(const SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT void SetPrevious(const SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT void SetNext(const SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT void SetFirst(const SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT void SetTreeID(const std::string& value); + +Standard_EXPORT bool Append(SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT bool Prepend(SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT bool Remove(); +Standard_EXPORT bool InsertBefore(SALOMEDSImpl_AttributeTreeNode* value); +Standard_EXPORT bool InsertAfter(SALOMEDSImpl_AttributeTreeNode* value); + +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetFather() const { return myFather; } +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetPrevious() const { return myPrevious; } +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetNext() const { return myNext; } +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetFirst() const { return myFirst; } + +Standard_EXPORT bool HasFather() { return (myFather); } +Standard_EXPORT bool HasPrevious() { return (myPrevious); } +Standard_EXPORT bool HasNext() {return (myNext); } +Standard_EXPORT bool HasFirst() { return (myFirst); } +Standard_EXPORT const std::string& GetTreeID() { return ID(); } +Standard_EXPORT int Depth() const; +Standard_EXPORT bool IsRoot() const ; +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* Root() const; +Standard_EXPORT bool IsAscendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const; +Standard_EXPORT bool IsDescendant(const SALOMEDSImpl_AttributeTreeNode* value) const; +Standard_EXPORT bool IsFather(const SALOMEDSImpl_AttributeTreeNode* value) const; +Standard_EXPORT bool IsChild(const SALOMEDSImpl_AttributeTreeNode* value) const; + +Standard_EXPORT virtual std::string Save(); +Standard_EXPORT virtual void Load(const std::string&); +Standard_EXPORT virtual std::string Type(); + +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT void Paste(DF_Attribute* into); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT ~SALOMEDSImpl_AttributeTreeNode() {;} + +Standard_EXPORT virtual void AfterAddition(); +Standard_EXPORT virtual void BeforeForget(); private: -Standard_GUID myTreeID; -Handle(SALOMEDSImpl_AttributeTreeNode) myFather; -Handle(SALOMEDSImpl_AttributeTreeNode) myPrevious; -Handle(SALOMEDSImpl_AttributeTreeNode) myNext; -Handle(SALOMEDSImpl_AttributeTreeNode) myFirst; +std::string myTreeID; +SALOMEDSImpl_AttributeTreeNode* myFather; +SALOMEDSImpl_AttributeTreeNode* myPrevious; +SALOMEDSImpl_AttributeTreeNode* myNext; +SALOMEDSImpl_AttributeTreeNode* myFirst; friend class SALOMEDSImpl_ChildNodeIterator; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx index 62a420b0b..b2ba71eca 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.cxx @@ -26,13 +26,10 @@ 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) +SALOMEDSImpl_AttributeUserID* SALOMEDSImpl_AttributeUserID::Set (const DF_Label& L, const std::string& ID) { - Handle(SALOMEDSImpl_AttributeUserID) A; - if (!L.FindAttribute(ID, A)) { + SALOMEDSImpl_AttributeUserID* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeUserID*)L.FindAttribute(ID))) { A = new SALOMEDSImpl_AttributeUserID(); A->SetValue(ID); L.AddAttribute(A); @@ -44,7 +41,7 @@ Handle(SALOMEDSImpl_AttributeUserID) SALOMEDSImpl_AttributeUserID::Set (const TD //function : ID //purpose : //======================================================================= -const Standard_GUID& SALOMEDSImpl_AttributeUserID::ID() const +const std::string& SALOMEDSImpl_AttributeUserID::ID() const { return myID; } @@ -52,7 +49,7 @@ const Standard_GUID& SALOMEDSImpl_AttributeUserID::ID() const //function : SetValue //purpose : //======================================================================= -void SALOMEDSImpl_AttributeUserID::SetValue( const Standard_GUID& guid) +void SALOMEDSImpl_AttributeUserID::SetValue( const std::string& guid) { CheckLocked(); if(myID == guid) return; @@ -67,9 +64,9 @@ void SALOMEDSImpl_AttributeUserID::SetValue( const Standard_GUID& guid) //function : NewEmpty //purpose : //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_AttributeUserID::NewEmpty () const +DF_Attribute* SALOMEDSImpl_AttributeUserID::NewEmpty () const { - Handle(SALOMEDSImpl_AttributeUserID) A = new SALOMEDSImpl_AttributeUserID(); + SALOMEDSImpl_AttributeUserID* A = new SALOMEDSImpl_AttributeUserID(); A->SetValue(myID); return A; } @@ -78,9 +75,9 @@ Handle(TDF_Attribute) SALOMEDSImpl_AttributeUserID::NewEmpty () const //function : Restore //purpose : //======================================================================= -void SALOMEDSImpl_AttributeUserID::Restore(const Handle(TDF_Attribute)& with) +void SALOMEDSImpl_AttributeUserID::Restore(DF_Attribute* with) { - Handle(SALOMEDSImpl_AttributeUserID) A = Handle(SALOMEDSImpl_AttributeUserID)::DownCast(with); + SALOMEDSImpl_AttributeUserID* A = dynamic_cast(with); SetValue( A->ID() ); } @@ -88,22 +85,19 @@ void SALOMEDSImpl_AttributeUserID::Restore(const Handle(TDF_Attribute)& with) //function : Paste //purpose : //======================================================================= -void SALOMEDSImpl_AttributeUserID::Paste (const Handle(TDF_Attribute)& into, - const Handle(TDF_RelocationTable)& RT) const +void SALOMEDSImpl_AttributeUserID::Paste (DF_Attribute* into) { - Handle(SALOMEDSImpl_AttributeUserID) A = Handle(SALOMEDSImpl_AttributeUserID)::DownCast(into); + SALOMEDSImpl_AttributeUserID* A = dynamic_cast(into); A->SetValue( myID ); } -TCollection_AsciiString SALOMEDSImpl_AttributeUserID::Type() +string SALOMEDSImpl_AttributeUserID::Type() { char* aUAttrName = new char[60]; - char aGUID[40]; - ID().ToCString(aGUID); - sprintf(aUAttrName, "AttributeUserID_%s",aGUID); + sprintf(aUAttrName, "AttributeUserID_%s",ID().c_str()); - TCollection_AsciiString ret(aUAttrName); + string ret(aUAttrName); delete aUAttrName; return ret; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx index ec1acdfc9..8d3ab95ac 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeUserID.hxx @@ -24,47 +24,37 @@ #ifndef _SALOMEDSImpl_AttributeUserID_HeaderFile #define _SALOMEDSImpl_AttributeUserID_HeaderFile -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include #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; +std::string 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 SALOMEDSImpl_AttributeUserID* Set (const DF_Label& L, const std::string& ID); +static const std::string& DefaultID() { - static Standard_GUID SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); + static std::string 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 const std::string& Value() const { return ID(); } +Standard_EXPORT void SetValue(const std::string& value); -Standard_EXPORT virtual TCollection_AsciiString Type(); +Standard_EXPORT virtual std::string 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 const std::string& ID() const; +Standard_EXPORT void Restore(DF_Attribute* with) ; +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste(DF_Attribute* into); Standard_EXPORT ~SALOMEDSImpl_AttributeUserID() {} -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeUserID ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx index 1488961bf..ff366e786 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx @@ -100,7 +100,7 @@ public : 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 == "AttributeUserID") return std::string("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(); \ @@ -110,9 +110,9 @@ public : if(theType == "AttributeString") return SALOMEDSImpl_AttributeString::GetID(); -#define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \ - Handle(SALOMEDSImpl_##ClassName) anAttr; \ - if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \ +#define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.c_str(), #ClassName) == 0) { \ + SALOMEDSImpl_##ClassName* anAttr; \ + if (!(anAttr=(SALOMEDSImpl_##ClassName*)Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID()))) { \ CheckLocked(); \ anAttr = new SALOMEDSImpl_##ClassName; \ Lab.AddAttribute(anAttr); \ @@ -120,9 +120,9 @@ public : return anAttr; \ } -#define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \ - Handle(SALOMEDSImpl_##ClassName) anAttr; \ - if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \ +#define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.c_str(), #ClassName) == 0) { \ + SALOMEDSImpl_##ClassName* anAttr; \ + if (!(anAttr=(SALOMEDSImpl_##ClassName*)Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID()))) { \ anAttr = new SALOMEDSImpl_##ClassName; \ Lab.AddAttribute(anAttr); \ } \ diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx index 6530d0bd7..834b82701 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Callback.cxx @@ -23,6 +23,4 @@ #include "SALOMEDSImpl_Callback.hxx" -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Callback, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Callback, MMgt_TShared ) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx index 285938254..313d1d305 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx @@ -24,38 +24,31 @@ #ifndef __SALOMEDSIMPL_CALLBACK_H__ #define __SALOMEDSIMPL_CALLBACK_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Callback, MMgt_TShared ) #include "SALOMEDSImpl_UseCaseBuilder.hxx" -class SALOMEDSImpl_Callback : public MMgt_TShared +class SALOMEDSImpl_Callback { private: - Handle(SALOMEDSImpl_UseCaseBuilder) _builder; + SALOMEDSImpl_UseCaseBuilder* _builder; public: - SALOMEDSImpl_Callback(const Handle(SALOMEDSImpl_UseCaseBuilder)& builder) + SALOMEDSImpl_Callback(SALOMEDSImpl_UseCaseBuilder* builder) { _builder = builder; } - virtual void OnAddSObject(Handle(SALOMEDSImpl_SObject) theObject) + virtual void OnAddSObject(const SALOMEDSImpl_SObject& theObject) { - if(_builder != NULL && theObject != NULL) _builder->Append(theObject); + if(_builder != NULL && theObject) _builder->Append(theObject); } - virtual void OnRemoveSObject(Handle(SALOMEDSImpl_SObject) theObject) + virtual void OnRemoveSObject(const SALOMEDSImpl_SObject& theObject) { - if(_builder != NULL && theObject != NULL) _builder->Remove(theObject); + if(_builder != NULL && theObject) _builder->Remove(theObject); } -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_Callback ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.cxx index 99184a8b3..e4a44457e 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.cxx @@ -21,43 +21,39 @@ // 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) +SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const SALOMEDSImpl_SObject& theSO) { _so = theSO; - _it = TDF_ChildIterator(_so->GetLabel()); + _it = DF_ChildIterator(_so.GetLabel()); } -SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const TDF_Label& theLabel) +SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const DF_Label& theLabel) { _so = SALOMEDSImpl_Study::SObject(theLabel); - _it = TDF_ChildIterator(theLabel); + _it = DF_ChildIterator(theLabel); } void SALOMEDSImpl_ChildIterator::Init() { - _it.Initialize(_so->GetLabel(), Standard_False); + if(_so) _it.Init(_so.GetLabel(), false); } -void SALOMEDSImpl_ChildIterator::Init(const TDF_Label& theLabel) +void SALOMEDSImpl_ChildIterator::Init(const DF_Label& theLabel) { - _it.Initialize(theLabel, Standard_False); + _it.Init(theLabel, false); } void SALOMEDSImpl_ChildIterator::InitEx(bool theAllLevels) { - _it.Initialize(_so->GetLabel(), theAllLevels); + if(_so) _it.Init(_so.GetLabel(), theAllLevels); } -void SALOMEDSImpl_ChildIterator::InitEx(const TDF_Label& theLabel, bool theAllLevels) +void SALOMEDSImpl_ChildIterator::InitEx(const DF_Label& theLabel, bool theAllLevels) { - _it.Initialize(theLabel, theAllLevels); + _it.Init(theLabel, theAllLevels); } bool SALOMEDSImpl_ChildIterator::More() @@ -70,12 +66,22 @@ void SALOMEDSImpl_ChildIterator::Next() _it.Next(); } -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_ChildIterator::Value() +SALOMEDSImpl_SObject SALOMEDSImpl_ChildIterator::Value() { + if(!_so) return SALOMEDSImpl_SObject(); return SALOMEDSImpl_Study::SObject(_it.Value()); } -TDF_Label SALOMEDSImpl_ChildIterator::Label() +DF_Label SALOMEDSImpl_ChildIterator::Label() { return _it.Value(); } + +SALOMEDSImpl_ChildIterator* SALOMEDSImpl_ChildIterator::GetPersistentCopy() const +{ + SALOMEDSImpl_ChildIterator* itr = new SALOMEDSImpl_ChildIterator(); + itr->_it = _it; + itr->_so = _so; + return itr; +} + diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.hxx index 64f261d39..e3c50b9b0 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ChildIterator.hxx @@ -24,37 +24,33 @@ #ifndef __SALOMEDSImpl_CHILDITERATOR_H__ #define __SALOMEDSImpl_CHILDITERATOR_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_ChildIterator, MMgt_TShared ) #include "SALOMEDSImpl_SObject.hxx" -#include "TDF_ChildIterator.hxx" -#include "TDF_Label.hxx" +#include "DF_ChildIterator.hxx" +#include "DF_Label.hxx" -class SALOMEDSImpl_ChildIterator: public MMgt_TShared +class SALOMEDSImpl_ChildIterator { private: - TDF_ChildIterator _it; - Handle(SALOMEDSImpl_SObject) _so; + DF_ChildIterator _it; + 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 SALOMEDSImpl_ChildIterator(const SALOMEDSImpl_SObject& theSO); + Standard_EXPORT SALOMEDSImpl_ChildIterator(const DF_Label& theLabel); Standard_EXPORT ~SALOMEDSImpl_ChildIterator() {}; Standard_EXPORT virtual void Init(); - Standard_EXPORT virtual void Init(const TDF_Label& theLabel); + Standard_EXPORT virtual void Init(const DF_Label& theLabel); Standard_EXPORT virtual void InitEx(bool theAllLevels); - Standard_EXPORT virtual void InitEx(const TDF_Label& theLabel, bool theAllLevels); + Standard_EXPORT virtual void InitEx(const DF_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(); + Standard_EXPORT virtual SALOMEDSImpl_SObject Value(); + Standard_EXPORT virtual DF_Label Label(); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_SObject ) + Standard_EXPORT SALOMEDSImpl_ChildIterator* GetPersistentCopy() const; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.cxx index 602ab83d7..b1cc1ffd6 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.cxx @@ -27,9 +27,9 @@ #define ChildNodeIterator_UpToBrother \ { \ - while (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \ + while (myNode && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \ myNode = myNode->myFather; \ - if (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \ + if (myNode && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \ myNode = myNode->myNext; \ else \ myNode = NULL; \ @@ -48,8 +48,8 @@ SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator() //purpose : //======================================================================= -SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode, - const Standard_Boolean allLevels) +SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const SALOMEDSImpl_AttributeTreeNode* aNode, + const bool allLevels) : myNode(aNode->myFirst), myFirstLevel(allLevels ? aNode->Depth() : -1) {} @@ -59,8 +59,8 @@ SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const Handle(SAL //purpose : //======================================================================= -void SALOMEDSImpl_ChildNodeIterator::Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode, - const Standard_Boolean allLevels) +void SALOMEDSImpl_ChildNodeIterator::Initialize(const SALOMEDSImpl_AttributeTreeNode* aNode, + const bool allLevels) { myNode = aNode->myFirst; myFirstLevel = allLevels ? aNode->Depth() : -1; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.hxx index 56e2b7a57..21651a4e7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ChildNodeIterator.hxx @@ -21,42 +21,27 @@ #ifndef _SALOMEDSImpl_ChildNodeIterator_HeaderFile #define _SALOMEDSImpl_ChildNodeIterator_HeaderFile -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif - #include "SALOMEDSImpl_AttributeTreeNode.hxx" - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#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 SALOMEDSImpl_ChildNodeIterator(const SALOMEDSImpl_AttributeTreeNode* aTreeNode, + const bool allLevels = false); +Standard_EXPORT void Initialize(const SALOMEDSImpl_AttributeTreeNode* aTreeNode, + const bool allLevels = false) ; +Standard_EXPORT bool More() const { return (myNode); } Standard_EXPORT void Next() ; Standard_EXPORT void NextBrother() ; -Standard_EXPORT Handle_SALOMEDSImpl_AttributeTreeNode Value() const { return myNode; } +Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* Value() const { return myNode; } private: -Handle_SALOMEDSImpl_AttributeTreeNode myNode; -Standard_Integer myFirstLevel; +SALOMEDSImpl_AttributeTreeNode* myNode; +int myFirstLevel; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx index d2e49d842..88fac75f5 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx @@ -20,7 +20,7 @@ #ifndef __SALOMEDSIMPL_DRIVER_H__ #define __SALOMEDSIMPL_DRIVER_H__ -#include +#include #include #include #include @@ -30,71 +30,71 @@ class SALOMEDSImpl_Driver { public: - virtual TCollection_AsciiString GetIOR() = 0; + virtual std::string GetIOR() = 0; - virtual Handle(SALOMEDSImpl_TMPFile) Save(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile) = 0; + virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent, + const std::string& theURL, + long& theStreamLength, + bool isMultiFile) = 0; - virtual Handle(SALOMEDSImpl_TMPFile) SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, - const TCollection_AsciiString& theURL, - long& theStreamLength, - bool isMultiFile) = 0; + virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent, + const std::string& theURL, + long& theStreamLength, + bool isMultiFile) = 0; - virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent, + virtual bool Load(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const std::string& theURL, bool isMultiFile) = 0; - virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent, + virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, - const TCollection_AsciiString& theURL, + const std::string& theURL, bool isMultiFile) = 0; - virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent) = 0; + virtual void Close(const SALOMEDSImpl_SComponent& theComponent) = 0; - virtual TCollection_AsciiString ComponentDataType() = 0; + virtual std::string ComponentDataType() = 0; - virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject, - const TCollection_AsciiString& IORString, + virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject, + const std::string& IORString, bool isMultiFile, bool isASCII) = 0; - virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject, - const TCollection_AsciiString& aLocalPersistentID, + virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject, + const std::string& aLocalPersistentID, bool isMultiFile, bool isASCII) = 0; - virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) = 0; + virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject) = 0; - virtual Handle(SALOMEDSImpl_TMPFile) CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject, - int& theObjectID, - long& theStreamLength) = 0; + virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject, + int& theObjectID, + long& theStreamLength) = 0; - virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID) = 0; + virtual bool CanPaste(const std::string& theComponentName, int theObjectID) = 0; - virtual TCollection_AsciiString PasteInto(const unsigned char* theStream, + virtual std::string PasteInto(const unsigned char* theStream, const long theStreamLength, int theObjectID, - const Handle(SALOMEDSImpl_SObject)& theObject) = 0; + const SALOMEDSImpl_SObject& theObject) = 0; - virtual Handle(SALOMEDSImpl_TMPFile) DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy, - bool isPublished, - bool& isValidScript, - long& theStreamLength) = 0; + virtual SALOMEDSImpl_TMPFile* DumpPython(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* GetDriverByType(const std::string& theComponentType) = 0; - virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR) = 0; + virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR) = 0; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx index 346eff45b..168645bb0 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.cxx @@ -28,28 +28,25 @@ 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) +char* SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr) { - Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr); - return ga->Type().ToCString(); + SALOMEDSImpl_GenericAttribute* ga = dynamic_cast(theAttr); + return (char*)ga->Type().c_str(); } -char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(const Handle(TDF_Attribute)& theAttr) +char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr) { - Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr); - return ga->GetClassType().ToCString(); + SALOMEDSImpl_GenericAttribute* ga = dynamic_cast(theAttr); + return (char*)ga->GetClassType().c_str(); } -void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(const Handle(TDF_Attribute)& theAttr) +void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(DF_Attribute* theAttr) { - Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr); + SALOMEDSImpl_GenericAttribute* ga = dynamic_cast(theAttr); ga->CheckLocked(); } -TCollection_AsciiString SALOMEDSImpl_GenericAttribute::Type() +string SALOMEDSImpl_GenericAttribute::Type() { return _type; } @@ -57,30 +54,31 @@ TCollection_AsciiString SALOMEDSImpl_GenericAttribute::Type() void SALOMEDSImpl_GenericAttribute::CheckLocked() { - TDF_Label aLabel = Label(); + DF_Label aLabel = Label(); if(aLabel.IsNull()) return; - Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel); - if(aStudy.IsNull() || aStudy->NewBuilder()->HasOpenCommand()) return; + SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel); + if(!aStudy) return; if(aStudy->IsLocked()) { aStudy->_errorCode = "LockProtection"; throw LockProtection("LockProtection"); } } -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_GenericAttribute::GetSObject() +SALOMEDSImpl_SObject SALOMEDSImpl_GenericAttribute::GetSObject() { - TDF_Label aLabel = Label(); - if(aLabel.IsNull()) return NULL; + SALOMEDSImpl_SObject so; + DF_Label aLabel = Label(); + if(aLabel.IsNull()) return so; return SALOMEDSImpl_Study::SObject(aLabel); } void SALOMEDSImpl_GenericAttribute::SetModifyFlag() { - TDF_Label aLabel = Label(); + DF_Label aLabel = Label(); if(aLabel.IsNull()) return; - Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel); - if(!aStudy.IsNull()) aStudy->Modify(); + SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel); + if(aStudy) aStudy->Modify(); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx index bf5cc8709..345e0fd64 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_GenericAttribute.hxx @@ -24,46 +24,33 @@ #ifndef _GENERICIMPL_ATTRIBUTE_HXX_ #define _GENERICIMPL_ATTRIBUTE_HXX_ -#include -#include -#include -#include -#include +#include "DF_Label.hxx" +#include "DF_Attribute.hxx" +#include #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 +class SALOMEDSImpl_GenericAttribute: public DF_Attribute { protected: - TCollection_AsciiString _type; //This field must be filled in each attribute that inherits from this class. + std::string _type; //This field must be filled in each attribute that inherits from this class. public: -Standard_EXPORT SALOMEDSImpl_GenericAttribute(const TCollection_AsciiString& theType) +Standard_EXPORT SALOMEDSImpl_GenericAttribute(const std::string& 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 std::string Type(); Standard_EXPORT virtual void CheckLocked(); -Standard_EXPORT TCollection_AsciiString GetClassType() { return _type; } -Standard_EXPORT Handle(SALOMEDSImpl_SObject) GetSObject(); +Standard_EXPORT std::string GetClassType() { return _type; } +Standard_EXPORT 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 ) +Standard_EXPORT static char* Impl_GetType(DF_Attribute* theAttr); +Standard_EXPORT static char* Impl_GetClassType(DF_Attribute* theAttr); +Standard_EXPORT static void Impl_CheckLocked(DF_Attribute* theAttr); }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx index b6324819b..876bcf344 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.cxx @@ -19,8 +19,6 @@ #include "SALOMEDSImpl_IParameters.hxx" #include -#include - #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_ChildIterator.hxx" @@ -34,12 +32,12 @@ using namespace std; /*! Constructor */ -SALOMEDSImpl_IParameters::SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap) +SALOMEDSImpl_IParameters::SALOMEDSImpl_IParameters(SALOMEDSImpl_AttributeParameter* ap) { - if(ap.IsNull()) return; + if(!ap) return; _ap = ap; - Handle(SALOMEDSImpl_SObject) so = _ap->GetSObject(); - _study = so->GetStudy(); + SALOMEDSImpl_SObject so = _ap->GetSObject(); + _study = so.GetStudy(); } SALOMEDSImpl_IParameters::~SALOMEDSImpl_IParameters() @@ -49,7 +47,7 @@ SALOMEDSImpl_IParameters::~SALOMEDSImpl_IParameters() int SALOMEDSImpl_IParameters::append(const string& listName, const string& value) { - if(_ap.IsNull()) return -1; + if(!_ap) return -1; vector v; if(!_ap->IsSet(listName, PT_STRARRAY)) { if(!_ap->IsSet(_AP_LISTS_LIST_, PT_STRARRAY)) _ap->SetStrArray(_AP_LISTS_LIST_, v); @@ -67,7 +65,7 @@ int SALOMEDSImpl_IParameters::append(const string& listName, const string& value int SALOMEDSImpl_IParameters::nbValues(const string& listName) { - if(_ap.IsNull()) return -1; + if(!_ap) return -1; if(!_ap->IsSet(listName, PT_STRARRAY)) return 0; vector v = _ap->GetStrArray(listName); return v.size(); @@ -76,7 +74,7 @@ int SALOMEDSImpl_IParameters::nbValues(const string& listName) vector SALOMEDSImpl_IParameters::getValues(const string& listName) { vector v; - if(_ap.IsNull()) return v; + if(!_ap) return v; if(!_ap->IsSet(listName, PT_STRARRAY)) return v; return _ap->GetStrArray(listName); } @@ -84,7 +82,7 @@ vector SALOMEDSImpl_IParameters::getValues(const string& listName) string SALOMEDSImpl_IParameters::getValue(const string& listName, int index) { - if(_ap.IsNull()) return ""; + if(!_ap) return ""; if(!_ap->IsSet(listName, PT_STRARRAY)) return ""; vector v = _ap->GetStrArray(listName); if(index >= v.size()) return ""; @@ -100,7 +98,7 @@ vector SALOMEDSImpl_IParameters::getLists() void SALOMEDSImpl_IParameters::setParameter(const string& entry, const string& parameterName, const string& value) { - if(_ap.IsNull()) return; + if(!_ap) return; vector v; if(!_ap->IsSet(entry, PT_STRARRAY)) { append(_AP_ENTRIES_LIST_, entry); //Add the entry to the internal list of entries @@ -115,7 +113,7 @@ void SALOMEDSImpl_IParameters::setParameter(const string& entry, const string& p string SALOMEDSImpl_IParameters::getParameter(const string& entry, const string& parameterName) { - if(_ap.IsNull()) return ""; + if(!_ap) return ""; if(!_ap->IsSet(entry, PT_STRARRAY)) return ""; vector v = _ap->GetStrArray(entry); int length = v.size(); @@ -129,7 +127,7 @@ string SALOMEDSImpl_IParameters::getParameter(const string& entry, const string& vector SALOMEDSImpl_IParameters::getAllParameterNames(const string& entry) { vector v, names; - if(_ap.IsNull()) return v; + if(!_ap) return v; if(!_ap->IsSet(entry, PT_STRARRAY)) return v; v = _ap->GetStrArray(entry); int length = v.size(); @@ -142,7 +140,7 @@ vector SALOMEDSImpl_IParameters::getAllParameterNames(const string& entr vector SALOMEDSImpl_IParameters::getAllParameterValues(const string& entry) { vector v, values; - if(_ap.IsNull()) return v; + if(!_ap) return v; if(!_ap->IsSet(entry, PT_STRARRAY)) return v; v = _ap->GetStrArray(entry); int length = v.size(); @@ -154,7 +152,7 @@ vector SALOMEDSImpl_IParameters::getAllParameterValues(const string& ent int SALOMEDSImpl_IParameters::getNbParameters(const string& entry) { - if(_ap.IsNull()) return -1; + if(!_ap) return -1; if(!_ap->IsSet(entry, PT_STRARRAY)) return -1; return _ap->GetStrArray(entry).size()/2; } @@ -162,14 +160,14 @@ int SALOMEDSImpl_IParameters::getNbParameters(const string& entry) vector SALOMEDSImpl_IParameters::getEntries() { vector v; - if(_ap.IsNull()) return v; + if(!_ap) return v; if(!_ap->IsSet(_AP_ENTRIES_LIST_, PT_STRARRAY)) return v; return _ap->GetStrArray(_AP_ENTRIES_LIST_); } void SALOMEDSImpl_IParameters::setProperty(const string& name, const std::string& value) { - if(_ap.IsNull()) return; + if(!_ap) return; if(!_ap->IsSet(name, PT_STRING)) { append(_AP_PROPERTIES_LIST_, name); //Add the property to the internal list of properties } @@ -178,7 +176,7 @@ void SALOMEDSImpl_IParameters::setProperty(const string& name, const std::string string SALOMEDSImpl_IParameters::getProperty(const string& name) { - if(_ap.IsNull()) return ""; + if(!_ap) return ""; if(!_ap->IsSet(name, PT_STRING)) return ""; return _ap->GetString(name); } @@ -186,7 +184,7 @@ string SALOMEDSImpl_IParameters::getProperty(const string& name) vector SALOMEDSImpl_IParameters::getProperties() { vector v; - if(_ap.IsNull()) return v; + if(!_ap) return v; if(!_ap->IsSet(_AP_PROPERTIES_LIST_, PT_STRARRAY)) return v; return _ap->GetStrArray(_AP_PROPERTIES_LIST_); } @@ -195,14 +193,14 @@ string SALOMEDSImpl_IParameters::decodeEntry(const string& entry) { if(!_study) return entry; int pos = entry.rfind("_"); - if(pos < 0 || pos >= entry.length()) return entry; + if(pos < 0 || pos >= entry.size()) return entry; string compName(entry, 0, pos), compID, tail(entry, pos+1, entry.length()-1); if(_compNames.find(compName) == _compNames.end()) { - Handle(SALOMEDSImpl_SObject) so = _study->FindComponent((char*)compName.c_str()); - if(so.IsNull()) return entry; - compID = so->GetID().ToCString(); + SALOMEDSImpl_SObject so = _study->FindComponent(compName); + if(!so) return entry; + compID = so.GetID(); _compNames[compName] = compID; } else compID = _compNames[compName]; @@ -214,37 +212,37 @@ string SALOMEDSImpl_IParameters::decodeEntry(const string& entry) } -bool SALOMEDSImpl_IParameters::isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID) +bool SALOMEDSImpl_IParameters::isDumpPython(SALOMEDSImpl_Study* study, const string& theID) { string anID; if(theID == "") anID = getDefaultVisualComponent(); else anID = theID; - Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetCommonParameters((char*)anID.c_str(), 0); - if(ap.IsNull()) return false; + SALOMEDSImpl_AttributeParameter* ap = study->GetCommonParameters((char*)anID.c_str(), 0); + if(!ap) return false; if(!ap->IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN)) return false; return (bool)ap->GetBool(_AP_DUMP_PYTHON_); } -int SALOMEDSImpl_IParameters::getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const string& theID) +int SALOMEDSImpl_IParameters::getLastSavePoint(SALOMEDSImpl_Study* study, const string& theID) { string anID; if(theID == "") anID = getDefaultVisualComponent(); else anID = theID; - Handle(SALOMEDSImpl_SObject) so = study->FindComponent((char*)anID.c_str()); - if(so.IsNull()) return -1; + SALOMEDSImpl_SObject so = study->FindComponent(anID); + if(!so) return -1; - Handle(SALOMEDSImpl_StudyBuilder) builder = study->NewBuilder(); - Handle(SALOMEDSImpl_ChildIterator) anIter ( study->NewChildIterator( so ) ); + SALOMEDSImpl_StudyBuilder* builder = study->NewBuilder(); + SALOMEDSImpl_ChildIterator anIter = study->NewChildIterator( so ); int tag = -1; - for(; anIter->More(); anIter->Next()) + for(; anIter.More(); anIter.Next()) { - Handle(SALOMEDSImpl_SObject) val( anIter->Value() ); - Handle(SALOMEDSImpl_GenericAttribute) genAttr; - if(builder->FindAttribute(val, genAttr, "AttributeParameter")) tag = val->Tag(); + SALOMEDSImpl_SObject val( anIter.Value() ); + DF_Attribute* genAttr; + if(builder->FindAttribute(val, genAttr, "AttributeParameter")) tag = val.Tag(); } return tag; @@ -252,13 +250,13 @@ int SALOMEDSImpl_IParameters::getLastSavePoint(const Handle(SALOMEDSImpl_Study)& -string SALOMEDSImpl_IParameters::getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID) +string SALOMEDSImpl_IParameters::getStudyScript(SALOMEDSImpl_Study* study, int savePoint, const std::string& theID) { string anID; if(theID == "") anID = getDefaultVisualComponent(); else anID = theID; - Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetCommonParameters((char*)anID.c_str(), savePoint); + SALOMEDSImpl_AttributeParameter* ap = study->GetCommonParameters((char*)anID.c_str(), savePoint); SALOMEDSImpl_IParameters ip(ap); string dump(""); @@ -290,10 +288,10 @@ string SALOMEDSImpl_IParameters::getStudyScript(const Handle(SALOMEDSImpl_Study) return dump; } -string SALOMEDSImpl_IParameters::getDefaultScript(const Handle(SALOMEDSImpl_Study)& study, - const string& moduleName, - const string& shift, - const string& theID) +string SALOMEDSImpl_IParameters::getDefaultScript(SALOMEDSImpl_Study* study, + const string& moduleName, + const string& shift, + const string& theID) { string anID; if(theID == "") anID = getDefaultVisualComponent(); @@ -306,7 +304,7 @@ string SALOMEDSImpl_IParameters::getDefaultScript(const Handle(SALOMEDSImpl_Stud SALOMEDSImpl_IParameters ip = SALOMEDSImpl_IParameters(study->GetCommonParameters(anID.c_str(), savePoint)); if(!isDumpPython(study)) return dump; - Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetModuleParameters(anID.c_str(), moduleName.c_str(), savePoint); + SALOMEDSImpl_AttributeParameter* ap = study->GetModuleParameters(anID.c_str(), moduleName.c_str(), savePoint); ip = SALOMEDSImpl_IParameters(ap); @@ -340,9 +338,9 @@ string SALOMEDSImpl_IParameters::getDefaultScript(const Handle(SALOMEDSImpl_Stud vector names = ip.getAllParameterNames(v[i]); vector values = ip.getAllParameterValues(v[i]); string decodedEntry = ip.decodeEntry(v[i]); - Handle(SALOMEDSImpl_SObject) so = study->FindObjectID((char*)decodedEntry.c_str()); + SALOMEDSImpl_SObject so = study->FindObjectID(decodedEntry); string so_name(""); - if(!so.IsNull()) so_name = so->GetName().ToCString(); + if(so) so_name = so.GetName(); dump += shift + "# set up entry " + v[i] +" ("+so_name+")" + " parameters" + "\n"; for(int j = 0; j < names.size() && j < values.size(); j++) dump += shift + "ipar.setParameter(\"" + v[i] + "\", \"" + names[j] + "\", \"" + values[j] + "\")\n"; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx index 756df15c8..a197b28ef 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx @@ -32,7 +32,7 @@ class Standard_EXPORT SALOMEDSImpl_IParameters { public: - SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap); + SALOMEDSImpl_IParameters(SALOMEDSImpl_AttributeParameter* ap); virtual ~SALOMEDSImpl_IParameters(); @@ -117,23 +117,23 @@ public: /*! Returns whether there is the dumping visual parameters */ - static bool isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID = ""); + static bool isDumpPython(SALOMEDSImpl_Study* study, const std::string& theID = ""); /*! Returns an ID of the last save point */ - static int getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const std::string& theID = ""); + static int getLastSavePoint(SALOMEDSImpl_Study* study, const std::string& theID = ""); /*! Returns a Python script for the study, which sets up visual parameters */ - static std::string getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID = ""); + static std::string getStudyScript(SALOMEDSImpl_Study* study, int savePoint, const std::string& theID = ""); /*! Returns a default Python script that set ups visual parameters for the given module shift is a string that contain spaces to make valid Python script indentaion */ - static std::string getDefaultScript(const Handle(SALOMEDSImpl_Study)& study, + static std::string getDefaultScript(SALOMEDSImpl_Study* study, const std::string& moduleName, const std::string& shift, const std::string& theID = ""); @@ -144,8 +144,8 @@ public: static std::string getDefaultVisualComponent(); private: - Handle(SALOMEDSImpl_AttributeParameter) _ap; - Handle(SALOMEDSImpl_Study) _study; + SALOMEDSImpl_AttributeParameter* _ap; + SALOMEDSImpl_Study* _study; std::map _compNames; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.cxx deleted file mode 100644 index d1c76693e..000000000 --- a/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.cxx +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : 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"); -} - - - - - diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx deleted file mode 100644 index 3f39b21e7..000000000 --- a/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SALOMEDSImpl_OCAFApplication.hxx -// Author : Sergey RUIN -// Module : SALOME - -#ifndef _SALOMEDSImpl_OCAFApplication_HeaderFile -#define _SALOMEDSImpl_OCAFApplication_HeaderFile - - -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_OCAFApplication, TDocStd_Application) - -#include -#include - - -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 diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx index 640ce8468..ba28d3744 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.cxx @@ -28,15 +28,34 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject ) +//============================================================================ +/*! Function : Empty constructor + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent() +{ +} + +//============================================================================ +/*! Function : Copy constructor + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const SALOMEDSImpl_SComponent& theSCO) +{ + _lab = theSCO._lab; + _value = theSCO._value; + _type = theSCO._type; + _name = theSCO._name; +} //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const TDF_Label& theLabel) +SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const DF_Label& theLabel) :SALOMEDSImpl_SObject(theLabel) { } @@ -47,7 +66,8 @@ SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const TDF_Label& theLabel) */ //============================================================================ SALOMEDSImpl_SComponent::~SALOMEDSImpl_SComponent() -{} +{ +} //============================================================================ @@ -55,11 +75,11 @@ SALOMEDSImpl_SComponent::~SALOMEDSImpl_SComponent() * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_SComponent::ComponentDataType() +string SALOMEDSImpl_SComponent::ComponentDataType() { - TCollection_AsciiString res = ""; - Handle(SALOMEDSImpl_AttributeComment) type; - if ( _lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type) ) { + string res = ""; + SALOMEDSImpl_AttributeComment* type; + if ( (type = (SALOMEDSImpl_AttributeComment*)_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID())) ) { res = type->Value(); } @@ -72,22 +92,22 @@ TCollection_AsciiString SALOMEDSImpl_SComponent::ComponentDataType() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_SComponent::ComponentIOR(TCollection_AsciiString& IOR) +bool SALOMEDSImpl_SComponent::ComponentIOR(string& IOR) { - Handle(SALOMEDSImpl_AttributeIOR) ior; - if (!_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),ior) ) + SALOMEDSImpl_AttributeIOR* ior; + if (!(ior = (SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID())) ) return false; IOR = ior->Value(); return true; } - + //============================================================================ /*! Function : IsA * Purpose : */ //============================================================================ -bool SALOMEDSImpl_SComponent::IsA(const TDF_Label& theLabel) +bool SALOMEDSImpl_SComponent::IsA(const DF_Label& theLabel) { // scomponent must contain comment and belong to the 2th depth label if ( theLabel.IsAttribute(SALOMEDSImpl_AttributeComment::GetID()) && theLabel.Depth() == 2) { @@ -95,3 +115,18 @@ bool SALOMEDSImpl_SComponent::IsA(const TDF_Label& theLabel) } return false; } + +//============================================================================ +/*! Function : GetPersistentCopy + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SComponent* SALOMEDSImpl_SComponent::GetPersistentCopy() const +{ + SALOMEDSImpl_SComponent* sco = new SALOMEDSImpl_SComponent; + sco->_lab = _lab; + sco->_name = _name; + sco->_type = _type; + sco->_value = _value; + return sco; +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx index 0def77820..1803e537a 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SComponent.hxx @@ -27,34 +27,31 @@ //SALOMEDSImpl headers #include "SALOMEDSImpl_SObject.hxx" -//Handle definition -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject ) - // std C++ headers #include +#include // Cascade headers -#include -#include -#include -#include +#include "DF_Label.hxx" +#include "SALOMEDSImpl_SObject.hxx" #include -class SALOMEDSImpl_SComponent : public SALOMEDSImpl_SObject +class SALOMEDSImpl_SComponent : public virtual SALOMEDSImpl_SObject { public: - SALOMEDSImpl_SComponent(const TDF_Label& lab); + Standard_EXPORT SALOMEDSImpl_SComponent(); + Standard_EXPORT SALOMEDSImpl_SComponent(const SALOMEDSImpl_SComponent& theSCO); + Standard_EXPORT SALOMEDSImpl_SComponent(const DF_Label& lab); - ~SALOMEDSImpl_SComponent(); + Standard_EXPORT ~SALOMEDSImpl_SComponent(); - virtual TCollection_AsciiString ComponentDataType(); - virtual bool ComponentIOR(TCollection_AsciiString& theID); - static bool IsA(const TDF_Label& theLabel); + Standard_EXPORT virtual std::string ComponentDataType(); + Standard_EXPORT virtual bool ComponentIOR(std::string& theID); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_SComponent ) + Standard_EXPORT static bool IsA(const DF_Label& theLabel); + + Standard_EXPORT SALOMEDSImpl_SComponent* GetPersistentCopy() const; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.cxx index feddbb503..bcad98c11 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.cxx @@ -33,10 +33,10 @@ using namespace std; */ //============================================================================ -SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument) +SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(DF_Document* theDocument) { _lab = theDocument->Main(); - _it.Initialize (_lab); + _it.Init (_lab); } //============================================================================ @@ -46,7 +46,7 @@ SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(const Handle(TD //============================================================================ void SALOMEDSImpl_SComponentIterator::Init() { - _it.Initialize (_lab); + _it.Init (_lab); } //============================================================================ @@ -58,14 +58,11 @@ bool SALOMEDSImpl_SComponentIterator::More() { if (!_it.More()) return false; - TDF_Label L = _it.Value(); - if (SALOMEDSImpl_SComponent::IsA(L)) - return true; - - return _it.More(); + DF_Label L = _it.Value(); + return SALOMEDSImpl_SComponent::IsA(L); } - //============================================================================ +//============================================================================ /*! Function : Next */ //============================================================================ @@ -80,8 +77,20 @@ void SALOMEDSImpl_SComponentIterator::Next() * */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SComponentIterator::Value() +SALOMEDSImpl_SComponent SALOMEDSImpl_SComponentIterator::Value() { return SALOMEDSImpl_Study::SComponent(_it.Value()); } +//============================================================================ +/*! Function : GetPersistentCopy + */ +//============================================================================ +SALOMEDSImpl_SComponentIterator* SALOMEDSImpl_SComponentIterator::GetPersistentCopy() const +{ + SALOMEDSImpl_SComponentIterator* itr = new SALOMEDSImpl_SComponentIterator(); + itr->_lab = _lab; + itr->_it = _it; + + return itr; +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.hxx index 0c076ea31..1194fc191 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SComponentIterator.hxx @@ -29,17 +29,17 @@ #include "SALOMEDSImpl_SComponent.hxx" // Cascade headers -#include -#include -#include +#include "DF_ChildIterator.hxx" +#include "DF_Label.hxx" +#include "DF_Document.hxx" #include class Standard_EXPORT SALOMEDSImpl_SComponentIterator { private: - TDF_ChildIterator _it; - TDF_Label _lab; + DF_ChildIterator _it; + DF_Label _lab; public: @@ -51,13 +51,15 @@ public: SALOMEDSImpl_SComponentIterator() {}; - SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument); + SALOMEDSImpl_SComponentIterator(DF_Document* theDocument); ~SALOMEDSImpl_SComponentIterator() {}; virtual void Init(); virtual bool More(); virtual void Next(); - virtual Handle(SALOMEDSImpl_SComponent) Value(); + virtual SALOMEDSImpl_SComponent Value(); + + SALOMEDSImpl_SComponentIterator* GetPersistentCopy() const; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx index bf4ff3bee..b385b7baa 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.cxx @@ -31,18 +31,38 @@ using namespace std; -#include #include -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SObject, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SObject, MMgt_TShared ) +//============================================================================ +/*! Function : empty constructor + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SObject::SALOMEDSImpl_SObject() +{ +} + +//============================================================================ +/*! Function : copy constructor + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const SALOMEDSImpl_SObject& theSObject) +{ + _lab = theSObject._lab; + _value = theSObject._value; + _type = theSObject._type; + _name = theSObject._name; + +} + //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const TDF_Label& theLabel) +SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const DF_Label& theLabel) :_lab(theLabel) { _value = ""; @@ -56,18 +76,17 @@ SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const TDF_Label& theLabel) */ //============================================================================ SALOMEDSImpl_SObject::~SALOMEDSImpl_SObject() -{} +{ +} //============================================================================ /*! Function : GetID * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_SObject::GetID() +string SALOMEDSImpl_SObject::GetID() const { - TCollection_AsciiString anEntry; - TDF_Tool::Entry (_lab,anEntry); - return anEntry; + return _lab.Entry(); } //============================================================================ @@ -75,14 +94,15 @@ TCollection_AsciiString SALOMEDSImpl_SObject::GetID() * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SObject::GetFatherComponent() +SALOMEDSImpl_SComponent SALOMEDSImpl_SObject::GetFatherComponent() const { - TDF_Label LF = _lab; + SALOMEDSImpl_SComponent sco; + DF_Label LF = _lab; while (!SALOMEDSImpl_SComponent::IsA(LF) && !LF.IsRoot()) { LF = LF.Father(); } - if(LF.IsRoot()) return NULL; + if(LF.IsRoot()) return sco; return GetStudy()->GetSComponent(LF); } @@ -92,7 +112,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SObject::GetFatherComponent() * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_SObject::GetFather() +SALOMEDSImpl_SObject SALOMEDSImpl_SObject::GetFather() const { return GetStudy()->GetSObject(_lab.Father()); } @@ -103,7 +123,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_SObject::GetFather() * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_SObject::GetStudy() +SALOMEDSImpl_Study* SALOMEDSImpl_SObject::GetStudy() const { return SALOMEDSImpl_Study::GetStudy(_lab); } @@ -113,13 +133,13 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_SObject::GetStudy() * Purpose : Find attribute of given type on this SObject */ //============================================================================ -bool SALOMEDSImpl_SObject::FindAttribute(Handle(TDF_Attribute)& theAttribute, - const TCollection_AsciiString& theTypeOfAttribute) +bool SALOMEDSImpl_SObject::FindAttribute(DF_Attribute*& theAttribute, + const string& theTypeOfAttribute) const { - if(_lab.IsNull()) return Standard_False; - Standard_GUID aGUID = GetGUID(theTypeOfAttribute); - if (_lab.FindAttribute(aGUID, theAttribute)) return Standard_True; - return Standard_False; + if(_lab.IsNull()) return false; + std::string aGUID = GetGUID(theTypeOfAttribute); + if ((theAttribute = _lab.FindAttribute(aGUID))) return true; + return false; } @@ -129,19 +149,16 @@ bool SALOMEDSImpl_SObject::FindAttribute(Handle(TDF_Attribute)& theAttribute, * Purpose : Returns list of all attributes for this sobject */ //============================================================================ -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_SObject::GetAllAttributes() +vector SALOMEDSImpl_SObject::GetAllAttributes() const { - 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); - } + vector va1, va = _lab.GetAttributes(); + for(int i = 0, len = va.size(); i(va[i]); + if(ga && ga->Type() != string("AttributeReference")) + va1.push_back(va[i]); } - return SeqOfAttr; + + return va1; } @@ -150,10 +167,10 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_SObject::GetAllAttributes() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_SObject::ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_SObject::ReferencedObject(SALOMEDSImpl_SObject& theObject) const { - Handle(SALOMEDSImpl_AttributeReference) Ref; - if (!_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(),Ref)) + SALOMEDSImpl_AttributeReference* Ref; + if (!(Ref=(SALOMEDSImpl_AttributeReference*)_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) return false; theObject = GetStudy()->GetSObject(Ref->Get()); @@ -165,9 +182,9 @@ bool SALOMEDSImpl_SObject::ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObj * Purpose : */ //============================================================================ -bool SALOMEDSImpl_SObject::FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_SObject::FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject) { - TDF_Label L = _lab.FindChild(theTag, false); + DF_Label L = _lab.FindChild(theTag, false); if (L.IsNull()) return false; theObject = GetStudy()->GetSObject(L); @@ -181,12 +198,12 @@ bool SALOMEDSImpl_SObject::FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_SObject::GetName() +string SALOMEDSImpl_SObject::GetName() const { - TCollection_AsciiString aStr = ""; - Handle(SALOMEDSImpl_AttributeName) aName; - if (_lab.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) { - aStr = aName->Value(); + string aStr = ""; + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)_lab.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { + aStr =aName->Value(); } return aStr; } @@ -196,11 +213,11 @@ TCollection_AsciiString SALOMEDSImpl_SObject::GetName() * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_SObject::GetComment() +string SALOMEDSImpl_SObject::GetComment() const { - TCollection_AsciiString aStr = ""; - Handle(SALOMEDSImpl_AttributeComment) aComment; - if (_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComment)) { + string aStr = ""; + SALOMEDSImpl_AttributeComment* aComment; + if ((aComment=(SALOMEDSImpl_AttributeComment*)_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) { aStr = aComment->Value(); } return aStr; @@ -211,30 +228,64 @@ TCollection_AsciiString SALOMEDSImpl_SObject::GetComment() * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_SObject::GetIOR() +string SALOMEDSImpl_SObject::GetIOR() const { - TCollection_AsciiString aStr = ""; - Handle(SALOMEDSImpl_AttributeIOR) anIOR; - if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anIOR)) { - aStr = anIOR->Value(); + string aStr = ""; + SALOMEDSImpl_AttributeIOR* anIOR; + if ((anIOR=(SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + aStr = dynamic_cast(anIOR)->Value(); } return aStr; } -Standard_GUID SALOMEDSImpl_SObject::GetGUID(const TCollection_AsciiString& theType) +std::string SALOMEDSImpl_SObject::GetGUID(const string& 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; + if (strncmp(theType.c_str(), "AttributeTreeNodeGUID",21) == 0) { + return theType.substr(21, theType.size()); } - return Standard_GUID(); + return ""; } +//============================================================================ +/*! Function : SALOMEDSImpl_SComponent + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SObject::operator SALOMEDSImpl_SComponent() const +{ + SALOMEDSImpl_SComponent sco; + sco._lab = _lab; + sco._name = _name; + sco._type = _type; + sco._value = _value; + return sco; +} + +//============================================================================ +/*! Function : GetPersistentCopy + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_SObject* SALOMEDSImpl_SObject::GetPersistentCopy() const +{ + SALOMEDSImpl_SObject* so = new SALOMEDSImpl_SObject; + so->_lab = _lab; + so->_name = _name; + so->_type = _type; + so->_value = _value; + return so; +} + +//============================================================================ +/*! Function : IsComponent + * Purpose : + */ +//============================================================================ +bool SALOMEDSImpl_SObject::IsComponent() const +{ + return SALOMEDSImpl_SComponent::IsA(_lab); +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx index c0cced62b..80d797e41 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_SObject.hxx @@ -24,62 +24,62 @@ #ifndef __SALOMEDSIMPL_SOBJECT_H__ #define __SALOMEDSIMPL_SOBJECT_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_SObject, MMgt_TShared ) +#include "DF_Label.hxx" +#include "DF_Attribute.hxx" +#include +#include class SALOMEDSImpl_SComponent; -class Handle_SALOMEDSImpl_SComponent; class SALOMEDSImpl_Study; -class Handle_SALOMEDSImpl_Study; -// Cascade headers -#include -#include -#include -#include -#include -#include -#include - -class SALOMEDSImpl_SObject : public MMgt_TShared +class SALOMEDSImpl_SObject { protected: - TDF_Label _lab; - TCollection_AsciiString _name; - TCollection_AsciiString _value; - TCollection_AsciiString _type; + DF_Label _lab; + std::string _name; + std::string _value; + std::string _type; public: - Standard_EXPORT SALOMEDSImpl_SObject(const TDF_Label& theLabel); - Standard_EXPORT ~SALOMEDSImpl_SObject(); + Standard_EXPORT SALOMEDSImpl_SObject(); + Standard_EXPORT SALOMEDSImpl_SObject(const DF_Label& theLabel); + Standard_EXPORT SALOMEDSImpl_SObject(const SALOMEDSImpl_SObject& theSObject); + Standard_EXPORT virtual ~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 std::string GetID() const; + Standard_EXPORT virtual SALOMEDSImpl_SComponent GetFatherComponent() const; + Standard_EXPORT virtual SALOMEDSImpl_SObject GetFather() const ; + Standard_EXPORT virtual bool FindAttribute(DF_Attribute*& theAttribute, const std::string& theTypeOfAttribute) const; + Standard_EXPORT virtual bool ReferencedObject(SALOMEDSImpl_SObject& theObject) const ; + Standard_EXPORT virtual bool FindSubObject(int theTag, 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 SALOMEDSImpl_Study* GetStudy() const; + Standard_EXPORT virtual std::string Name() const { return _name; } + Standard_EXPORT virtual void Name(const std::string& theName) { _name = theName; } + Standard_EXPORT virtual std::vector GetAllAttributes() const; - Standard_EXPORT virtual TCollection_AsciiString GetName(); - Standard_EXPORT virtual TCollection_AsciiString GetComment(); - Standard_EXPORT virtual TCollection_AsciiString GetIOR(); + Standard_EXPORT virtual std::string GetName() const ; + Standard_EXPORT virtual std::string GetComment() const; + Standard_EXPORT virtual std::string GetIOR() const; - Standard_EXPORT virtual int Tag() { return _lab.Tag(); } - Standard_EXPORT virtual int Depth() { return _lab.Depth(); } + Standard_EXPORT virtual int Tag() const { return _lab.Tag(); } + Standard_EXPORT virtual int Depth() const { return _lab.Depth(); } - Standard_EXPORT virtual TDF_Label GetLabel() { return _lab; } + Standard_EXPORT virtual DF_Label GetLabel() const { return _lab; } - Standard_EXPORT static Standard_GUID GetGUID(const TCollection_AsciiString& theTypeOfAttribute); + Standard_EXPORT bool IsNull() const { return _lab.IsNull(); } -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_SObject ) + Standard_EXPORT bool IsComponent() const; + + Standard_EXPORT operator SALOMEDSImpl_SComponent() const; + + Standard_EXPORT operator bool () const { return !IsNull(); } + + Standard_EXPORT SALOMEDSImpl_SObject* GetPersistentCopy() const; + + Standard_EXPORT static std::string GetGUID(const std::string& theTypeOfAttribute); + + }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 518929b81..3a3096d81 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -26,19 +26,8 @@ using namespace std; -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "DF_Application.hxx" +#include "DF_ChildIterator.hxx" #include "SALOMEDSImpl_ChildNodeIterator.hxx" #include "SALOMEDSImpl_Attributes.hxx" @@ -48,38 +37,34 @@ using namespace std; #include "SALOMEDSImpl_Tool.hxx" #include "SALOMEDSImpl_IParameters.hxx" -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Study, MMgt_TShared ) +#include #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) +SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc, + const string& study_name) { - doc->SetUndoLimit(1); // mpv (IPAL9237): if there is no undo limit, operations mechanism couldn't work _name = study_name; - _doc = doc; + _doc = (DF_Document*)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 + //It will be used to retrieve the study object by DF_Label that belongs to the study SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this); - _lockers = new TColStd_HSequenceOfAsciiString(); } @@ -96,24 +81,24 @@ SALOMEDSImpl_Study::~SALOMEDSImpl_Study() * Purpose : Get persistent reference of study (idem URL()) */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetPersistentReference() +string SALOMEDSImpl_Study::GetPersistentReference() { _errorCode = ""; return URL(); } //============================================================================ /*! Function : GetTransientReference - * Purpose : Get IOR of the Study (registred in OCAF document in doc->Root) + * Purpose : Get IOR of the Study (registred in Document in doc->Root) */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetTransientReference() +string SALOMEDSImpl_Study::GetTransientReference() { _errorCode = ""; - TCollection_AsciiString IOR = ""; + string IOR = ""; - Handle(SALOMEDSImpl_AttributeIOR) Att; - TDF_Label _lab = _doc->GetData()->Root(); - if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)) { + SALOMEDSImpl_AttributeIOR* Att; + DF_Label _lab = _doc->Root(); + if ((Att=(SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { IOR = Att->Value(); } else { @@ -123,18 +108,18 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetTransientReference() return IOR; } -void SALOMEDSImpl_Study::SetTransientReference(const TCollection_AsciiString& theIOR) +void SALOMEDSImpl_Study::SetTransientReference(const string& theIOR) { _errorCode = ""; - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties(); + SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties(); int aLocked = aProp->IsLocked(); - if (aLocked) aProp->SetLocked(Standard_False); + if (aLocked) aProp->SetLocked(false); // Assign the value of the IOR in the study->root SALOMEDSImpl_AttributeIOR::Set(_doc->Main().Root(), theIOR); - if (aLocked) aProp->SetLocked(Standard_True); + if (aLocked) aProp->SetLocked(true); } //============================================================================ @@ -145,7 +130,7 @@ void SALOMEDSImpl_Study::SetTransientReference(const TCollection_AsciiString& th bool SALOMEDSImpl_Study::IsEmpty() { _errorCode = ""; - if (_doc.IsNull()) return true; + if (!_doc) return true; return _doc->IsEmpty(); } @@ -154,17 +139,17 @@ bool SALOMEDSImpl_Study::IsEmpty() * Purpose : Find a Component with ComponentDataType = aComponentName */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollection_AsciiString& aComponentName) +SALOMEDSImpl_SComponent SALOMEDSImpl_Study::FindComponent (const string& aComponentName) { _errorCode = ""; bool _find = false; - TCollection_AsciiString name; + string name; SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator(); - Handle(SALOMEDSImpl_SComponent) compo; + SALOMEDSImpl_SComponent compo; for (; itcomp.More(); itcomp.Next()) { - Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value(); - name = SC->ComponentDataType(); + SALOMEDSImpl_SComponent SC = itcomp.Value(); + name = SC.ComponentDataType(); if(aComponentName == name) { _find = true; return SC; @@ -174,7 +159,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollec if(!_find) { _errorCode = "No component was found"; - return NULL; + return compo; } return compo; } @@ -184,20 +169,20 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollec * Purpose : Find a Component from it's ID */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TCollection_AsciiString& aComponentID) +SALOMEDSImpl_SComponent SALOMEDSImpl_Study::FindComponentID(const string& 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; + string ID; + SALOMEDSImpl_SComponent compo; SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator(); for (; itcomp.More(); itcomp.Next()) { - Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value(); - ID = SC->GetID(); + SALOMEDSImpl_SComponent SC = itcomp.Value(); + ID = SC.GetID(); if(aComponentID == ID) { // ComponentID found @@ -208,7 +193,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TColle if(!_find) { _errorCode = "No component was found"; - compo = NULL; + compo = compo; } return compo; @@ -219,7 +204,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TColle * Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_AsciiString& anObjectName) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObject(const string& anObjectName) { _errorCode = ""; @@ -227,14 +212,14 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_As // After testing the component name, iterate in all objects defined under // components (function _FindObject) bool _find = false; - Handle(SALOMEDSImpl_SObject) RefSO = NULL; + SALOMEDSImpl_SObject RefSO; SALOMEDSImpl_SComponentIterator it = NewComponentIterator(); for (; it.More();it.Next()){ if(!_find) { - Handle(SALOMEDSImpl_SComponent) SC = it.Value(); - if (SC->GetName() == anObjectName) + SALOMEDSImpl_SComponent SC = it.Value(); + if (SC.GetName() == anObjectName) { _find = true; RefSO = SC; @@ -243,7 +228,7 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_As if (!_find) RefSO = _FindObject(SC, anObjectName, _find); } } - if(RefSO.IsNull()) _errorCode = "No object was found"; + if(!RefSO) _errorCode = "No object was found"; return RefSO; } @@ -252,17 +237,17 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_As * Purpose : Find an Object with ID = anObjectID */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectID(const TCollection_AsciiString& anObjectID) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectID(const string& anObjectID) { _errorCode = ""; - - // Convert aSO->GetID in TDF_Label. - TDF_Label Lab; - TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab); + SALOMEDSImpl_SObject so; + + // Convert aSO->GetID in DF_Label. + DF_Label Lab = DF_Label::Label(_doc->Main(), anObjectID, false); if (Lab.IsNull()) { _errorCode = "No label was found by ID"; - return NULL; + return so; } return GetSObject(Lab); @@ -273,17 +258,17 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectID(const TCollection_ * Purpose : Creates an Object with ID = anObjectID */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::CreateObjectID(const TCollection_AsciiString& anObjectID) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::CreateObjectID(const string& anObjectID) { _errorCode = ""; + SALOMEDSImpl_SObject so; - // Convert aSO->GetID in TDF_Label. - TDF_Label Lab; - TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab, Standard_True); + // Convert aSO->GetID in DF_Label. + DF_Label Lab = DF_Label::Label(_doc->Main(), anObjectID, true); if (Lab.IsNull()) { _errorCode = "Can not create a label"; - return NULL; + return so; } return GetSObject(Lab); @@ -295,38 +280,38 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::CreateObjectID(const TCollectio * : with ComponentDataType = aComponentName */ //============================================================================ -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const TCollection_AsciiString& anObjectName, - const TCollection_AsciiString& aComponentName) +vector SALOMEDSImpl_Study::FindObjectByName(const string& anObjectName, + const string& aComponentName) { _errorCode = ""; - Handle(TColStd_HSequenceOfTransient) listSO = new TColStd_HSequenceOfTransient(); + vector listSO; - Handle(SALOMEDSImpl_SComponent) compo = FindComponent(aComponentName) ; - if ( compo.IsNull() ) { + SALOMEDSImpl_SComponent compo = FindComponent(aComponentName) ; + if ( !compo ) { _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 ; + string childName ; - TCollection_AsciiString compoId = compo->GetID(); - Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(compo); - for ( ; it->More(); it->Next() ) { + string compoId = compo.GetID(); + SALOMEDSImpl_ChildIterator it = NewChildIterator(compo); + for ( ; it.More(); it.Next() ) { - Handle(SALOMEDSImpl_SObject) CSO = it->Value(); - if ( CSO->GetName() == anObjectName ) { + SALOMEDSImpl_SObject CSO = it.Value(); + if ( CSO.GetName() == anObjectName ) { /* add to list */ - listSO->Append(CSO) ; + listSO.push_back(CSO) ; } /* looks also for eventual children */ bool found = false ; CSO = _FindObject( CSO, anObjectName, found ) ; if( found) { - listSO->Append(CSO) ; + listSO.push_back(CSO) ; } } @@ -340,23 +325,23 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const * Purpose : Find an Object with IOR = anObjectIOR */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection_AsciiString& anObjectIOR) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectIOR(const string& anObjectIOR) { _errorCode = ""; - - Handle(SALOMEDSImpl_SObject) aResult = NULL; - + + SALOMEDSImpl_SObject aResult ; + // searching in the datamap for optimization - if (myIORLabels.IsBound(anObjectIOR)) { - aResult = GetSObject(myIORLabels.Find(anObjectIOR)); + if (myIORLabels.find(anObjectIOR) != myIORLabels.end()) { + aResult = GetSObject(myIORLabels[anObjectIOR]); // 11 oct 2002: forbidden attributes must be checked here - if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) { - myIORLabels.UnBind(anObjectIOR); - aResult = NULL; - } + if (!aResult.GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) { + myIORLabels.erase(anObjectIOR); + aResult = SALOMEDSImpl_SObject(); + } } - - if (aResult.IsNull()) _errorCode = "No object was found"; + + if(!aResult) _errorCode = "No object was found"; return aResult; } @@ -365,61 +350,60 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection * Purpose : Find an Object by its path = thePath */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollection_AsciiString& thePath) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectByPath(const string& thePath) { _errorCode = ""; - TCollection_AsciiString aPath(thePath), aToken; - Handle(SALOMEDSImpl_SObject) aSO = NULL; - int i = 1, aLength = aPath.Length(); + string aPath(thePath), aToken; + SALOMEDSImpl_SObject aSO; + int aLength = aPath.size(); bool isRelative = false; if(aLength == 0) { //Empty path - return the current context return GetSObject(_current); } - if(aPath.Value(1) != '/') //Relative path + if(aPath[0] != '/') //Relative path isRelative = true; - TDF_ChildIterator anIterator; - TDF_Label aLabel; - Handle(SALOMEDSImpl_AttributeName) anAttr; + DF_ChildIterator anIterator; + DF_Label aLabel; + SALOMEDSImpl_AttributeName* anAttr; if(isRelative) { - if(_current.IsNull()) return NULL; - anIterator.Initialize(_current, Standard_False); + if(_current.IsNull()) return aSO; + anIterator.Init(_current, false); } else { - if(aPath.Length() == 1 && aPath.Value(1) == '/') { //Root + if(aPath.size() == 1 && aPath[0] == '/') { //Root return GetSObject(_doc->Main()); } - anIterator.Initialize(_doc->Main(), Standard_False); + anIterator.Init(_doc->Main(), false); } - while(i <= aLength) { + vector vs = SALOMEDSImpl_Tool::splitString(aPath, '/'); + for(int i = 0, len = vs.size(); iValue() == 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) + if(i == (len-1)) { //The searched label is found (no part of the path is left) return GetSObject(aLabel); } - anIterator.Initialize(aLabel, Standard_False); + anIterator.Init(aLabel, false); break; } } } - i++; } - if(aSO.IsNull()) _errorCode = "No object was found"; + if(!aSO) _errorCode = "No object was found"; return aSO; } @@ -428,27 +412,27 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollect * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject) +string SALOMEDSImpl_Study::GetObjectPath(const SALOMEDSImpl_SObject& theObject) { _errorCode = ""; - TCollection_AsciiString aPath(""); - if(theObject.IsNull()) { + string aPath(""); + if(!theObject) { _errorCode = "Null object"; - return aPath.ToCString(); + return aPath; } - TCollection_AsciiString aName = theObject->GetName(); - if(!aName.IsEmpty() && aName != "" ) { - TCollection_AsciiString aValue((char*)aName.ToCString()); - aValue.Prepend("/"); + string aName = theObject.GetName(); + if(!aName.empty() && aName != "" ) { + string aValue("/"); + aValue+=aName; 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(); + SALOMEDSImpl_SObject aFather = theObject.GetFather(); + if(aFather) { + aName = aFather.GetName(); + if(!aName.empty() && aName != "") { + aValue = GetObjectPath(aFather); aPath = aValue + aPath; } } @@ -463,13 +447,13 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSI * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection_AsciiString& theIOR) +string SALOMEDSImpl_Study::GetObjectPathByIOR(const string& theIOR) { _errorCode = ""; - TCollection_AsciiString aPath; - Handle(SALOMEDSImpl_SObject) so = FindObjectIOR(theIOR); - if(so.IsNull()) { + string aPath; + SALOMEDSImpl_SObject so = FindObjectIOR(theIOR); + if(!so) { _errorCode = "No SObject was found by IOR"; return aPath; } @@ -483,19 +467,19 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection * Purpose : Sets the current context */ //============================================================================ -bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath) +bool SALOMEDSImpl_Study::SetContext(const string& thePath) { _errorCode = ""; - if(thePath.IsEmpty()) { + if(thePath.empty()) { _errorCode = "InvalidPath"; return false; } - TCollection_AsciiString aPath(thePath), aContext(""); + string aPath(thePath), aContext(""); bool isInvalid = false; - Handle(SALOMEDSImpl_SObject) aSO; + SALOMEDSImpl_SObject aSO; - if(aPath.Value(1) != '/') { //Relative path + if(aPath[0] != '/') { //Relative path aContext = GetContext(); aContext += '/'; aContext += aPath; @@ -504,18 +488,18 @@ bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath) aContext = aPath; try { - aSO = FindObjectByPath(aContext.ToCString()); + aSO = FindObjectByPath(aContext); } catch( ... ) { isInvalid = true; } - if(isInvalid || aSO.IsNull()) { + if(isInvalid || !aSO) { _errorCode = "InvalidContext"; return false; } - TDF_Label aLabel = aSO->GetLabel(); + DF_Label aLabel = aSO.GetLabel(); if(aLabel.IsNull()) { _errorCode = "InvalidContext"; return false; @@ -531,7 +515,7 @@ bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath) * Purpose : Gets the current context */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::GetContext() +string SALOMEDSImpl_Study::GetContext() { _errorCode = ""; @@ -539,7 +523,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetContext() _errorCode = "InvaidContext"; return ""; } - Handle(SALOMEDSImpl_SObject) so = GetSObject(_current); + SALOMEDSImpl_SObject so = GetSObject(_current); return GetObjectPath(so); } @@ -548,16 +532,16 @@ TCollection_AsciiString SALOMEDSImpl_Study::GetContext() * 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) +vector SALOMEDSImpl_Study::GetObjectNames(const string& theContext) { _errorCode = ""; - Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString; - TDF_Label aLabel; - if (theContext.IsEmpty()) { + vector aResultSeq; + DF_Label aLabel; + if (theContext.empty()) { aLabel = _current; } else { - TDF_Label aTmp = _current; + DF_Label aTmp = _current; SetContext(theContext); aLabel = _current; _current = aTmp; @@ -567,11 +551,12 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels + DF_ChildIterator anIter (aLabel, true); // 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()); + DF_Label aLabel = anIter.Value(); + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) + aResultSeq.push_back(aName->Value()); } return aResultSeq; @@ -582,16 +567,16 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const * 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) +vector SALOMEDSImpl_Study::GetDirectoryNames(const string& theContext) { _errorCode = ""; - Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString; - TDF_Label aLabel; - if (theContext.IsEmpty()) { + vector aResultSeq; + DF_Label aLabel; + if (theContext.empty()) { aLabel = _current; } else { - TDF_Label aTmp = _current; + DF_Label aTmp = _current; SetContext(theContext); aLabel = _current; _current = aTmp; @@ -601,15 +586,15 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(con return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_True); // iterate first-level children at all sublevels + DF_ChildIterator anIter (aLabel, true); // 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)) { + DF_Label aLabel = anIter.Value(); + SALOMEDSImpl_AttributeLocalID* anID; + if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) { if (anID->Value() == DIRECTORYID) { - Handle(SALOMEDSImpl_AttributeName) aName; - if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) { - aResultSeq->Append(aName->Value()); + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { + aResultSeq.push_back(aName->Value()); } } } @@ -623,16 +608,16 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(con * 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) +vector SALOMEDSImpl_Study::GetFileNames(const string& theContext) { _errorCode = ""; - Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString; - TDF_Label aLabel; - if (theContext.IsEmpty()) { + vector aResultSeq; + DF_Label aLabel; + if (theContext.empty()) { aLabel = _current; } else { - TDF_Label aTmp = _current; + DF_Label aTmp = _current; SetContext(theContext); aLabel = _current; _current = aTmp; @@ -642,17 +627,17 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TC return aResultSeq; } - TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels + DF_ChildIterator anIter (aLabel, true); // 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)) { + DF_Label aLabel = anIter.Value(); + SALOMEDSImpl_AttributeLocalID* anID; + if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) { 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))); + SALOMEDSImpl_AttributePersistentRef* aName; + if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) { + std::string aFileName = aName->Value(); + if (aFileName.size() > 0) + aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size())); } } } @@ -666,16 +651,17 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TC * Purpose : method to get all components names */ //============================================================================ -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(const TCollection_AsciiString& theContext) +vector SALOMEDSImpl_Study::GetComponentNames(const string& theContext) { _errorCode = ""; - Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString; - TDF_ChildIterator anIter(_doc->Main(), Standard_False); // iterate all subchildren at first level + vector aResultSeq; + DF_ChildIterator anIter(_doc->Main(), 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()); + DF_Label aLabel = anIter.Value(); + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) + aResultSeq.push_back(aName->Value()); } return aResultSeq; @@ -686,10 +672,10 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(con * Purpose : Create a ChildIterator from an SObject */ //============================================================================ -Handle(SALOMEDSImpl_ChildIterator) SALOMEDSImpl_Study::NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO) +SALOMEDSImpl_ChildIterator SALOMEDSImpl_Study::NewChildIterator(const SALOMEDSImpl_SObject& aSO) { _errorCode = ""; - return new SALOMEDSImpl_ChildIterator(aSO); + return SALOMEDSImpl_ChildIterator(aSO); } @@ -710,7 +696,7 @@ SALOMEDSImpl_SComponentIterator SALOMEDSImpl_Study::NewComponentIterator() * Purpose : Create a StudyBuilder */ //============================================================================ -Handle(SALOMEDSImpl_StudyBuilder) SALOMEDSImpl_Study::NewBuilder() +SALOMEDSImpl_StudyBuilder* SALOMEDSImpl_Study::NewBuilder() { _errorCode = ""; if(_autoFill) { @@ -726,7 +712,7 @@ Handle(SALOMEDSImpl_StudyBuilder) SALOMEDSImpl_Study::NewBuilder() * Purpose : get study name */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::Name() +string SALOMEDSImpl_Study::Name() { _errorCode = ""; return _name; @@ -737,7 +723,7 @@ TCollection_AsciiString SALOMEDSImpl_Study::Name() * Purpose : set study name */ //============================================================================ -void SALOMEDSImpl_Study::Name(const TCollection_AsciiString& name) +void SALOMEDSImpl_Study::Name(const string& name) { _errorCode = ""; _name = name; @@ -763,7 +749,7 @@ void SALOMEDSImpl_Study::IsSaved(bool save) { _errorCode = ""; _Saved = save; - if(save) _doc->UnModify(); + if(save) _doc->SetModified(false); } //============================================================================ @@ -786,7 +772,7 @@ bool SALOMEDSImpl_Study::IsModified() * Purpose : get URL of the study (persistent reference of the study) */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Study::URL() +string SALOMEDSImpl_Study::URL() { _errorCode = ""; return _URL; @@ -797,13 +783,13 @@ TCollection_AsciiString SALOMEDSImpl_Study::URL() * Purpose : set URL of the study (persistent reference of the study) */ //============================================================================ -void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url) +void SALOMEDSImpl_Study::URL(const string& url) { _errorCode = ""; _URL = url; /*jfa: Now name of SALOMEDS study will correspond to name of SalomeApp study - TCollection_AsciiString tmp(_URL); + string tmp(_URL); char *aName = (char*)tmp.ToCString(); char *adr = strtok(aName, "/"); @@ -822,25 +808,25 @@ void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url) * Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOMEDSImpl_SObject)& SO, - const TCollection_AsciiString& theObjectName, +SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& SO, + const string& theObjectName, bool& _find) { - if(SO.IsNull()) return NULL; + SALOMEDSImpl_SObject RefSO; + if(!SO) return RefSO; // 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; + SALOMEDSImpl_AttributeName* anAttr; - TCollection_AsciiString soid = SO->GetID(); - TDF_ChildIterator it(SO->GetLabel()); + string soid = SO.GetID(); + DF_ChildIterator it(SO.GetLabel()); for (; it.More(); it.Next()){ if(!_find) { - if (it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr)) + if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { - TCollection_AsciiString Val(anAttr->Value()); + string Val(anAttr->Value()); if (Val == theObjectName) { RefSO = GetSObject(it.Value()); @@ -858,25 +844,25 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOME * Purpose : Find an Object with SALOMEDSImpl_IOR = anObjectIOR */ //============================================================================ -Handle(SALOMEDSImpl_SObject) -SALOMEDSImpl_Study::_FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO, - const TCollection_AsciiString& theObjectIOR, +SALOMEDSImpl_SObject +SALOMEDSImpl_Study::_FindObjectIOR(const SALOMEDSImpl_SObject& SO, + const string& theObjectIOR, bool& _find) { - if(SO.IsNull()) return NULL; + SALOMEDSImpl_SObject RefSO, aSO; + if(!SO) return RefSO; // 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; + SALOMEDSImpl_AttributeIOR* anAttr; - TDF_ChildIterator it(SO->GetLabel()); + DF_ChildIterator it(SO.GetLabel()); for (; it.More();it.Next()){ if(!_find) { - if (it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr)) + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { - TCollection_AsciiString Val(anAttr->Value()); + string Val(anAttr->Value()); if (Val == theObjectIOR) { RefSO = GetSObject(it.Value()); @@ -908,51 +894,47 @@ void SALOMEDSImpl_Study::StudyId(int id) _StudyId = id; } -void SALOMEDSImpl_Study::UpdateIORLabelMap(const TCollection_AsciiString& anIOR,const TCollection_AsciiString& anEntry) +void SALOMEDSImpl_Study::UpdateIORLabelMap(const string& anIOR,const string& 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); + DF_Label aLabel = DF_Label::Label(_doc->Main(), anEntry, true); + if (myIORLabels.find(anIOR) != myIORLabels.end()) myIORLabels.erase(anIOR); + myIORLabels[anIOR] = aLabel; } -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_Study::GetStudy(const TDF_Label& theLabel) +SALOMEDSImpl_Study* SALOMEDSImpl_Study::GetStudy(const DF_Label& theLabel) { - Handle(SALOMEDSImpl_StudyHandle) Att; - if (theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID(),Att)) { - return Att->GetHandle(); + SALOMEDSImpl_StudyHandle* Att; + if ((Att=(SALOMEDSImpl_StudyHandle*)theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID()))) { + return Att->Get(); } return NULL; } -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::SObject(const TDF_Label& theLabel) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::SObject(const DF_Label& theLabel) { return GetStudy(theLabel)->GetSObject(theLabel); } -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::SComponent(const TDF_Label& theLabel) +SALOMEDSImpl_SComponent SALOMEDSImpl_Study::SComponent(const DF_Label& theLabel) { return GetStudy(theLabel)->GetSComponent(theLabel); } -void SALOMEDSImpl_Study::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute) +void SALOMEDSImpl_Study::IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute) { - TCollection_AsciiString aString; - TDF_Tool::Entry(theAttribute->Label(), aString); + string aString = theAttribute->Label().Entry(); GetStudy(theAttribute->Label())->UpdateIORLabelMap(theAttribute->Value(), aString); } -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject) +vector SALOMEDSImpl_Study::FindDependances(const SALOMEDSImpl_SObject& anObject) { _errorCode = ""; - Handle(TColStd_HSequenceOfTransient) aSeq; + vector aSeq; - Handle(SALOMEDSImpl_AttributeTarget) aTarget; - if (anObject->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget)) { + SALOMEDSImpl_AttributeTarget* aTarget; + if ((aTarget=(SALOMEDSImpl_AttributeTarget*)anObject.GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) { return aTarget->Get(); } @@ -960,48 +942,48 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const H } -Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties() +SALOMEDSImpl_AttributeStudyProperties* SALOMEDSImpl_Study::GetProperties() { _errorCode = ""; return SALOMEDSImpl_AttributeStudyProperties::Set(_doc->Main()); } -TCollection_AsciiString SALOMEDSImpl_Study::GetLastModificationDate() +string SALOMEDSImpl_Study::GetLastModificationDate() { _errorCode = ""; - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties(); + SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties(); - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + vector aNames; + vector aMinutes, aHours, aDays, aMonths, aYears; aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears); - int aLastIndex = aNames->Length(); + int aLastIndex = aNames.size()-1; 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); + (int)(aDays[aLastIndex]),(int)(aMonths[aLastIndex]), (int)(aYears[aLastIndex]), + (int)(aHours[aLastIndex]), (int)(aMinutes[aLastIndex])); + string aResStr (aResult); return aResStr; } -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate() +vector SALOMEDSImpl_Study::GetModificationsDate() { _errorCode = ""; - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties(); + SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties(); - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + vector aNames; + vector 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; + int anIndex, aLength = aNames.size(); + vector aDates; - for (anIndex = 2; anIndex <= aLength; anIndex++) { + for (anIndex = 1; 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); + (int)(aDays[anIndex]), (int)(aMonths[anIndex]), (int)(aYears[anIndex]), + (int)(aHours[anIndex]), (int)(aMinutes[anIndex])); + aDates.push_back(aDate); } return aDates; } @@ -1013,7 +995,7 @@ Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate( * Purpose : Returns a UseCase builder */ //============================================================================ -Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder() +SALOMEDSImpl_UseCaseBuilder* SALOMEDSImpl_Study::GetUseCaseBuilder() { _errorCode = ""; return _useCaseBuilder; @@ -1028,117 +1010,10 @@ Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder() 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; + _doc->GetApplication()->Close(_doc); + _doc = NULL; + _mapOfSO.clear(); + _mapOfSCO.clear(); } @@ -1147,16 +1022,15 @@ void SALOMEDSImpl_Study::UndoPostponed(const int theWay) * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollection_AsciiString& theEntry) +SALOMEDSImpl_SComponent SALOMEDSImpl_Study::GetSComponent(const string& theEntry) { - Handle(SALOMEDSImpl_SComponent) aSCO; - if(_mapOfSCO.IsBound(theEntry)) - aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_mapOfSCO.Find(theEntry)); + SALOMEDSImpl_SComponent aSCO; + if(_mapOfSCO.find(theEntry) != _mapOfSCO.end()) + aSCO = _mapOfSCO[theEntry]; else { - TDF_Label aLabel; - TDF_Tool::Label(_doc->GetData(), theEntry, aLabel); - aSCO = new SALOMEDSImpl_SComponent(aLabel); - _mapOfSCO.Bind(theEntry, aSCO); + DF_Label aLabel = DF_Label::Label(_doc->Main(), theEntry); + aSCO = SALOMEDSImpl_SComponent(aLabel); + _mapOfSCO[theEntry] = aSCO; } return aSCO; @@ -1167,11 +1041,9 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollect * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Label& theLabel) +SALOMEDSImpl_SComponent SALOMEDSImpl_Study::GetSComponent(const DF_Label& theLabel) { - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theLabel, anEntry); - return GetSComponent(anEntry); + return SALOMEDSImpl_SComponent(theLabel); } //============================================================================ @@ -1179,16 +1051,15 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Labe * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_AsciiString& theEntry) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::GetSObject(const string& theEntry) { - Handle(SALOMEDSImpl_SObject) aSO; - if(_mapOfSO.IsBound(theEntry)) - aSO = Handle(SALOMEDSImpl_SObject)::DownCast(_mapOfSO.Find(theEntry)); + SALOMEDSImpl_SObject aSO; + if(_mapOfSO.find(theEntry) != _mapOfSO.end()) + aSO = _mapOfSO[theEntry]; else { - TDF_Label aLabel; - TDF_Tool::Label(_doc->GetData(), theEntry, aLabel); - aSO = new SALOMEDSImpl_SObject(aLabel); - _mapOfSO.Bind(theEntry, aSO); + DF_Label aLabel = DF_Label::Label(_doc->Main(), theEntry); + aSO = SALOMEDSImpl_SObject(aLabel); + _mapOfSO[theEntry] = aSO; } return aSO; @@ -1199,11 +1070,9 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_As * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& theLabel) +SALOMEDSImpl_SObject SALOMEDSImpl_Study::GetSObject(const DF_Label& theLabel) { - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theLabel, anEntry); - return GetSObject(anEntry); + return SALOMEDSImpl_SObject(theLabel); } //============================================================================ @@ -1211,12 +1080,12 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& the * Purpose : */ //============================================================================ -Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiString& theEntry, - const TCollection_AsciiString& theType) +DF_Attribute* SALOMEDSImpl_Study::GetAttribute(const string& theEntry, + const string& theType) { - Handle(SALOMEDSImpl_SObject) aSO = GetSObject(theEntry); - Handle(TDF_Attribute) anAttr; - aSO->FindAttribute(anAttr, theType); + SALOMEDSImpl_SObject aSO = GetSObject(theEntry); + DF_Attribute* anAttr; + aSO.FindAttribute(anAttr, theType); return anAttr; } @@ -1225,8 +1094,8 @@ Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiSt * Purpose : */ //============================================================================ -bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, - const TCollection_AsciiString& theBaseName, +bool SALOMEDSImpl_Study::DumpStudy(const string& thePath, + const string& theBaseName, bool isPublished, SALOMEDSImpl_DriverFactory* theFactory) { @@ -1237,33 +1106,33 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, return false; } - TColStd_SequenceOfExtendedString aSeq; - TCollection_AsciiString aCompType, aFactoryType; + vector aSeq; + string 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(); + SALOMEDSImpl_SComponent sco = itcomponent.Value(); + aCompType = sco.ComponentDataType(); //GEOM and MED are independent components if (aCompType == "GEOM" || aCompType == "MED") - aSeq.Prepend(TCollection_ExtendedString(aCompType)); + aSeq.insert(aSeq.begin(), aCompType); else - aSeq.Append(TCollection_ExtendedString(aCompType)); + aSeq.push_back(aCompType); } #ifdef WIN32 - TCollection_AsciiString aFileName = - thePath + TCollection_AsciiString("\\") + theBaseName + TCollection_AsciiString(".py"); + string aFileName = + thePath + string("\\") + theBaseName + string(".py"); #else - TCollection_AsciiString aFileName = - thePath + TCollection_AsciiString("/") + theBaseName + TCollection_AsciiString(".py"); + string aFileName = + thePath + string("/") + theBaseName + string(".py"); #endif //Create a file that will contain a main Study script fstream fp; - fp.open(aFileName.ToCString(), ios::out); + fp.open(aFileName.c_str(), ios::out); #ifdef WIN32 bool isOpened = fp.is_open(); @@ -1272,15 +1141,15 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, #endif if(!isOpened) { - _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName; + _errorCode = string("Can't create a file ")+aFileName; return false; } - TCollection_AsciiString aBatchModeScript = "salome"; + string 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 << GetDumpStudyComment() << endl << endl; fp << "import sys" << endl; fp << "import " << aBatchModeScript << endl << endl; @@ -1300,26 +1169,26 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, } - Handle(TColStd_HSequenceOfAsciiString) aSeqOfFileNames = new TColStd_HSequenceOfAsciiString; + vector aSeqOfFileNames; //Iterate all components and create the componponents specific scripts. bool isOk = true; - int aLength = aSeq.Length(); + int aLength = aSeq.size(); for(int i = 1; i <= aLength; i++) { - aCompType = aSeq.Value(i); - Handle(SALOMEDSImpl_SComponent) sco = FindComponent(aCompType); + aCompType = aSeq[i-1]; + SALOMEDSImpl_SComponent sco = FindComponent(aCompType); SALOMEDSImpl_Driver* aDriver = NULL; // if there is an associated Engine call its method for saving - TCollection_AsciiString IOREngine; + string IOREngine; try { - if (!sco->ComponentIOR(IOREngine)) { - if (!aCompType.IsEmpty()) { + if (!sco.ComponentIOR(IOREngine)) { + if (!aCompType.empty()) { aDriver = theFactory->GetDriverByType(aCompType); if (aDriver != NULL) { - Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder(); + SALOMEDSImpl_StudyBuilder* SB = NewBuilder(); if(!SB->LoadWith(sco, aDriver)) { _errorCode = SB->GetErrorCode(); return false; @@ -1340,26 +1209,26 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, bool isValidScript; long aStreamLength = 0; - Handle(SALOMEDSImpl_TMPFile) aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength); + SALOMEDSImpl_TMPFile* 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("\\"); + aFileName=thePath+string("\\"); #else - aFileName=thePath+TCollection_AsciiString("/"); + aFileName=thePath+string("/"); #endif - TCollection_AsciiString aScriptName; + string aScriptName; aScriptName += theBaseName; aScriptName += "_"; aScriptName += aCompType; - aFileName += aScriptName+ TCollection_AsciiString(".py"); - aSeqOfFileNames->Append(aFileName); + aFileName += aScriptName+ string(".py"); + aSeqOfFileNames.push_back(aFileName); - fp2.open(aFileName.ToCString(), ios::out); + fp2.open(aFileName.c_str(), ios::out); #ifdef WIN32 isOpened = fp2.is_open(); @@ -1368,7 +1237,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, #endif if(!isOpened) { - _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName; + _errorCode = string("Can't create a file ")+aFileName; SALOMEDSImpl_Tool::RemoveTemporaryFiles(thePath, aSeqOfFileNames, false); return false; } @@ -1377,6 +1246,8 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, fp2 << aStream->Data(); fp2.close(); + if(aStream) delete aStream; + //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; @@ -1400,29 +1271,30 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, //purpose : return a header comment for a DumpStudy script //======================================================================= -TCollection_AsciiString SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName) +string SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName) { - TCollection_AsciiString txt + string txt ("### This file is generated by SALOME automatically by dump python functionality"); if ( theComponentName ) - txt += TCollection_AsciiString(" of ") + (char*) theComponentName + " component"; + txt += string(" of ") + (char*) theComponentName + " component"; return txt; } -void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, +void dumpSO(const SALOMEDSImpl_SObject& theSO, fstream& fp, - const TCollection_AsciiString& Tab, - const Handle(SALOMEDSImpl_Study) theStudy); + const string& Tab, + SALOMEDSImpl_Study* theStudy); + //============================================================================ /*! Function : dump * Purpose : */ //============================================================================ -void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName) +void SALOMEDSImpl_Study::dump(const string& theFileName) { //Create a file that will contain a main Study script fstream fp; - fp.open(theFileName.ToCString(), ios::out); + fp.open(theFileName.c_str(), ios::out); #ifdef WIN32 bool isOpened = fp.is_open(); @@ -1431,65 +1303,64 @@ void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName) #endif if(!isOpened) { - _errorCode = TCollection_AsciiString("Can't create a file ")+theFileName; + _errorCode = string("Can't create a file ")+theFileName; cout << "### SALOMEDSImpl_Study::dump Error: " << _errorCode << endl; return; } - Handle(SALOMEDSImpl_SObject) aSO = FindObjectID("0:1"); + 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); + SALOMEDSImpl_ChildIterator Itr = NewChildIterator(aSO); + string aTab(" "); + for(; Itr.More(); Itr.Next()) { + dumpSO(Itr.Value(), fp, aTab, this); } fp.close(); } -void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, +void dumpSO(const SALOMEDSImpl_SObject& theSO, fstream& fp, - const TCollection_AsciiString& Tab, - const Handle(SALOMEDSImpl_Study) theStudy) + const string& Tab, + SALOMEDSImpl_Study* theStudy) { - TCollection_AsciiString aTab(Tab), anID(theSO->GetID()); + string 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()); + vector attribs = theSO.GetLabel().GetAttributes(); + for(int i = 0; i(attribs[i]); - if(anAttr.IsNull()) { - fp << Tab << " -- " << anItr.Value()->DynamicType(); + if(!anAttr) { continue; } - TCollection_AsciiString aType = anAttr->GetClassType(); + string aType = anAttr->GetClassType(); fp << Tab << " -- " << aType; - if(aType == "AttributeReal") { - fp << " : " << Handle(SALOMEDSImpl_AttributeReal)::DownCast(anAttr)->Value(); + if(aType == string("AttributeReal")) { + fp << " : " << dynamic_cast(anAttr)->Value(); } - else if(aType == "AttributeInteger") { - fp << " : " << Handle(SALOMEDSImpl_AttributeInteger)::DownCast(anAttr)->Value(); + else if(aType == string("AttributeInteger")) { + fp << " : " << dynamic_cast(anAttr)->Value(); } - else if(aType == "AttributeName") { - fp << " : " << Handle(SALOMEDSImpl_AttributeName)::DownCast(anAttr)->Value(); + else if(aType == string("AttributeName")) { + fp << " : " << dynamic_cast(anAttr)->Value(); } - else if(aType == "AttributeComment") { - fp << " : " << Handle(SALOMEDSImpl_AttributeComment)::DownCast(anAttr)->Value(); + else if(aType == string("AttributeComment")) { + fp << " : " << dynamic_cast(anAttr)->Value(); } - else if(aType == "AttributeReference") { - fp << " : " << Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Save(); + else if(aType == string("AttributeReference")) { + fp << " : " << dynamic_cast(anAttr)->Save(); } fp << endl; } - Handle(SALOMEDSImpl_ChildIterator) Itr = theStudy->NewChildIterator(theSO); - TCollection_AsciiString aNewTab(" "); + SALOMEDSImpl_ChildIterator Itr = theStudy->NewChildIterator(theSO); + string aNewTab(" "); aNewTab+=aTab; - for(; Itr->More(); Itr->Next()) { - dumpSO(Itr->Value(), fp, aNewTab, theStudy); + for(; Itr.More(); Itr.Next()) { + dumpSO(Itr.Value(), fp, aNewTab, theStudy); } return; @@ -1498,7 +1369,7 @@ void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, void SALOMEDSImpl_Study::Modify() { _errorCode = ""; - _doc->Modify(); + _doc->SetModified(true); } //============================================================================ @@ -1506,28 +1377,29 @@ void SALOMEDSImpl_Study::Modify() * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint) +SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint) { if (theSavePoint < 0) return NULL; - Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder(); - Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID); - if (so.IsNull()) so = builder->NewComponent((char*)theID); - Handle(SALOMEDSImpl_AttributeParameter) attParam; + SALOMEDSImpl_StudyBuilder* builder = NewBuilder(); + SALOMEDSImpl_SObject so = FindComponent((char*)theID); + if (!so) so = builder->NewComponent((char*)theID); + SALOMEDSImpl_AttributeParameter* attParam = NULL; if (theSavePoint > 0) { // Try to find SObject that contains attribute parameter ... - TDF_Label savePointLabel = so->GetLabel().FindChild( theSavePoint, /*create=*/0 ); + DF_Label savePointLabel = so.GetLabel().FindChild( theSavePoint, /*create=*/0 ); if ( !savePointLabel.IsNull() ) so = GetSObject( savePointLabel ); else // ... if it does not exist - create a new one so = builder->NewObjectToTag( so, theSavePoint ); } - if (!so.IsNull()) { - builder->FindAttribute(so, attParam, "AttributeParameter"); - if ( attParam.IsNull() ) { // first call of GetCommonParameters on "Interface Applicative" component - Handle(TDF_Attribute) att = builder->FindOrCreateAttribute(so, "AttributeParameter"); - attParam = Handle(SALOMEDSImpl_AttributeParameter)::DownCast( att ); + DF_Attribute* A; + if (so) { + builder->FindAttribute(so, A, "AttributeParameter"); + if ( !A ) { // first call of GetCommonParameters on "Interface Applicative" component + A = builder->FindOrCreateAttribute(so, "AttributeParameter"); } + attParam = dynamic_cast( A ); } return attParam; } @@ -1537,30 +1409,28 @@ Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters( * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters(const char* theID, - const char* theModuleName, - int theSavePoint) +SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetModuleParameters(const char* theID, + const char* theModuleName, + int theSavePoint) { if(theSavePoint <= 0) return NULL; - Handle(SALOMEDSImpl_AttributeParameter) main_ap = GetCommonParameters(theID, theSavePoint); - Handle(SALOMEDSImpl_SObject) main_so = main_ap->GetSObject(); - Handle(SALOMEDSImpl_AttributeParameter) par; + SALOMEDSImpl_AttributeParameter* main_ap = GetCommonParameters(theID, theSavePoint); + SALOMEDSImpl_SObject main_so = main_ap->GetSObject(); + SALOMEDSImpl_AttributeParameter* par = NULL; - Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(main_so); + SALOMEDSImpl_ChildIterator it = NewChildIterator(main_so); string moduleName(theModuleName); - for(; it->More(); it->Next()) { - Handle(SALOMEDSImpl_SObject) so(it->Value()); - Handle(SALOMEDSImpl_GenericAttribute) ga; - if(so->FindAttribute(ga, "AttributeParameter")) { - par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(ga); + for(; it.More(); it.Next()) { + SALOMEDSImpl_SObject so(it.Value()); + if((par=(SALOMEDSImpl_AttributeParameter*)so.GetLabel().FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) { if(!par->IsSet("AP_MODULE_NAME", (Parameter_Types)3)) continue; //3 -> PT_STRING if(par->GetString("AP_MODULE_NAME") == moduleName) return par; } } - Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder(); - Handle(SALOMEDSImpl_SObject) so = builder->NewObject(main_so); - par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(so, "AttributeParameter")); + SALOMEDSImpl_StudyBuilder* builder = NewBuilder(); + SALOMEDSImpl_SObject so = builder->NewObject(main_so); + par = dynamic_cast(builder->FindOrCreateAttribute(so, "AttributeParameter")); par->SetString("AP_MODULE_NAME", moduleName); return par; } @@ -1572,7 +1442,7 @@ Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters( //============================================================================ void SALOMEDSImpl_Study::SetStudyLock(const char* theLockerID) { - _lockers->Append(TCollection_AsciiString((char*)theLockerID)); + _lockers.push_back(theLockerID); } //============================================================================ @@ -1582,7 +1452,7 @@ void SALOMEDSImpl_Study::SetStudyLock(const char* theLockerID) //============================================================================ bool SALOMEDSImpl_Study::IsStudyLocked() { - return (_lockers->Length() > 0); + return (_lockers.size() > 0); } //============================================================================ @@ -1592,15 +1462,17 @@ bool SALOMEDSImpl_Study::IsStudyLocked() //============================================================================ void SALOMEDSImpl_Study::UnLockStudy(const char* theLockerID) { - int length = _lockers->Length(), pos = -1; - TCollection_AsciiString id((char*)theLockerID); - for(int i = 1; i<=length; i++) { - if(id == _lockers->Value(i)) { - pos = i; + vector::iterator vsI = _lockers.begin(); + int length = _lockers.size(); + bool isFound = false; + string id(theLockerID); + for(int i = 0; i 0) _lockers->Remove(pos); + if(isFound) _lockers.erase(vsI); } //============================================================================ @@ -1608,7 +1480,7 @@ void SALOMEDSImpl_Study::UnLockStudy(const char* theLockerID) * Purpose : */ //============================================================================ -Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetLockerID() +vector SALOMEDSImpl_Study::GetLockerID() { return _lockers; } @@ -1630,3 +1502,18 @@ void SALOMEDSImpl_Study::EnableUseCaseAutoFilling(bool isEnabled) _builder->SetOnRemoveSObject(NULL); } } + +//============================================================================ +/*! Function : GetIORs + * Purpose : + */ +//============================================================================ +vector SALOMEDSImpl_Study::GetIORs() +{ + vector anIORs; + map::const_iterator MI; + for(MI = myIORLabels.begin(); MI!=myIORLabels.end(); MI++) + anIORs.push_back(MI->first); + + return anIORs; +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx index 449bd5a12..cfddeb627 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -24,26 +24,16 @@ #ifndef __SALOMEDSIMPL_STUDY_I_H__ #define __SALOMEDSIMPL_STUDY_I_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) - // std C++ headers #include +#include +#include +#include // Cascade headers -#include -#include -#include -#include +#include "DF_Document.hxx" +#include "DF_Label.hxx" #include -#include -#include -#include -#include -#include -#include //SALOMEDSImpl headers #include "SALOMEDSImpl_SComponentIterator.hxx" @@ -60,130 +50,123 @@ DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) class SALOMEDSImpl_StudyManager; class SALOMEDSImpl_GenericAttribute; -typedef NCollection_DataMap DataMapOfAsciiStringTransient; -typedef NCollection_DataMap DataMapAsciiStringLabel; -class SALOMEDSImpl_Study : public MMgt_TShared +class SALOMEDSImpl_Study { private: - TCollection_AsciiString _name; - Handle(TDocStd_Document) _doc; // OCAF Document + std::string _name; + DF_Document* _doc; // Document bool _Saved; // True if the Study is saved - TCollection_AsciiString _URL; //URL of the persistent reference of the study + std::string _URL; //URL of the persistent reference of the study int _StudyId; - TDF_Label _current; + DF_Label _current; bool _autoFill; - TCollection_AsciiString _errorCode; - Handle(TColStd_HSequenceOfAsciiString) _lockers; - 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; + std::string _errorCode; + std::vector _lockers; + SALOMEDSImpl_Callback* _cb; + SALOMEDSImpl_StudyBuilder* _builder; + SALOMEDSImpl_UseCaseBuilder* _useCaseBuilder; + + std::map _mapOfSO; + std::map _mapOfSCO; + std::map myIORLabels; - Handle(SALOMEDSImpl_SObject) _FindObject(const Handle(SALOMEDSImpl_SObject)& SO, - const TCollection_AsciiString& anObjectName, - bool& _find); + SALOMEDSImpl_SObject _FindObject(const SALOMEDSImpl_SObject& SO, + const std::string& anObjectName, + bool& _find); - Handle(SALOMEDSImpl_SObject) _FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO, - const TCollection_AsciiString& anObjectIOR, - bool& _find); + SALOMEDSImpl_SObject _FindObjectIOR(const SALOMEDSImpl_SObject& SO, + const std::string& 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_EXPORT static SALOMEDSImpl_Study* GetStudy(const DF_Label& theLabel); + Standard_EXPORT static SALOMEDSImpl_SObject SObject(const DF_Label& theLabel); + Standard_EXPORT static SALOMEDSImpl_SComponent SComponent(const DF_Label& theLabel); + Standard_EXPORT static void IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute); //! standard constructor - Standard_EXPORT SALOMEDSImpl_Study(const Handle(TDocStd_Document)&, const TCollection_AsciiString& study_name); + Standard_EXPORT SALOMEDSImpl_Study(const DF_Document*, const std::string& study_name); //! standard destructor Standard_EXPORT virtual ~SALOMEDSImpl_Study(); //! method to Get persistent reference of study (idem URL()) - Standard_EXPORT virtual TCollection_AsciiString GetPersistentReference(); + Standard_EXPORT virtual std::string GetPersistentReference(); //! method to Get transient reference of study - Standard_EXPORT virtual TCollection_AsciiString GetTransientReference(); + Standard_EXPORT virtual std::string GetTransientReference(); - Standard_EXPORT virtual void SetTransientReference(const TCollection_AsciiString& theIOR); + Standard_EXPORT virtual void SetTransientReference(const std::string& 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); + Standard_EXPORT virtual SALOMEDSImpl_SComponent FindComponent (const std::string& aComponentName); //! method to Find a Component Find a Component from it's ID - Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) FindComponentID(const TCollection_AsciiString& aComponentID); + Standard_EXPORT virtual SALOMEDSImpl_SComponent FindComponentID(const std::string& aComponentID); //! method to Find an Object with SALOMEDSImpl::Name = anObjectName - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObject(const TCollection_AsciiString& anObjectName); + Standard_EXPORT virtual SALOMEDSImpl_SObject FindObject(const std::string& 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 ) ; + Standard_EXPORT virtual std::vector FindObjectByName( const std::string& anObjectName, + const std::string& aComponentName ) ; //! method to Find an Object with ID = anObjectID - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectID(const TCollection_AsciiString& anObjectID); + Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectID(const std::string& anObjectID); //! method to Create an Object with ID = anObjectID - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) CreateObjectID(const TCollection_AsciiString& anObjectID); + Standard_EXPORT virtual SALOMEDSImpl_SObject CreateObjectID(const std::string& anObjectID); //! method to Find an Object with ID = anObjectIOR - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectIOR(const TCollection_AsciiString& anObjectIOR); + Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectIOR(const std::string& anObjectIOR); //! method to Find an Object by its path - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectByPath(const TCollection_AsciiString& thePath); + Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectByPath(const std::string& thePath); //! method to get a path of SObject - Standard_EXPORT virtual TCollection_AsciiString GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual std::string GetObjectPath(const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT TCollection_AsciiString GetObjectPathByIOR(const TCollection_AsciiString& theIOR); + Standard_EXPORT std::string GetObjectPathByIOR(const std::string& theIOR); //! method to set a context: root ('/') is UserData component - Standard_EXPORT virtual bool SetContext(const TCollection_AsciiString& thePath); + Standard_EXPORT virtual bool SetContext(const std::string& thePath); //! method to get a context - Standard_EXPORT virtual TCollection_AsciiString GetContext(); + Standard_EXPORT virtual std::string 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); + Standard_EXPORT virtual std::vector GetObjectNames(const std::string& 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); + Standard_EXPORT virtual std::vector GetDirectoryNames(const std::string& 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); + Standard_EXPORT virtual std::vector GetFileNames(const std::string& theContext); //! method to get all components names - Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetComponentNames(const TCollection_AsciiString& theContext); + Standard_EXPORT virtual std::vector GetComponentNames(const std::string& theContext); //! method to Create a ChildIterator from an SObject - Standard_EXPORT virtual Handle(SALOMEDSImpl_ChildIterator) NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO); + Standard_EXPORT virtual SALOMEDSImpl_ChildIterator NewChildIterator(const 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(); + Standard_EXPORT virtual SALOMEDSImpl_StudyBuilder* NewBuilder(); //! method to get study name - Standard_EXPORT virtual TCollection_AsciiString Name(); + Standard_EXPORT virtual std::string Name(); //! method to set study name - Standard_EXPORT virtual void Name(const TCollection_AsciiString& name); + Standard_EXPORT virtual void Name(const std::string& name); //! method to get if study has been saved Standard_EXPORT virtual bool IsSaved(); @@ -195,10 +178,10 @@ public: Standard_EXPORT virtual bool IsModified(); //! method to get URL of the study (idem GetPersistentReference) - Standard_EXPORT virtual TCollection_AsciiString URL(); + Standard_EXPORT virtual std::string URL(); //! method to set URL of the study - Standard_EXPORT virtual void URL(const TCollection_AsciiString& url); + Standard_EXPORT virtual void URL(const std::string& url); Standard_EXPORT virtual bool IsLocked(); @@ -206,64 +189,52 @@ public: Standard_EXPORT virtual void StudyId(int id); - Standard_EXPORT virtual void UpdateIORLabelMap(const TCollection_AsciiString& anIOR, const TCollection_AsciiString& aLabel); + Standard_EXPORT virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel); - Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject); + Standard_EXPORT virtual std::vector FindDependances(const SALOMEDSImpl_SObject& anObject); - Standard_EXPORT virtual Handle(SALOMEDSImpl_AttributeStudyProperties) GetProperties(); + Standard_EXPORT virtual SALOMEDSImpl_AttributeStudyProperties* GetProperties(); - Standard_EXPORT virtual TCollection_AsciiString GetLastModificationDate(); + Standard_EXPORT virtual std::string GetLastModificationDate(); - Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetModificationsDate(); + Standard_EXPORT virtual std::vector GetModificationsDate(); - Standard_EXPORT virtual Handle(SALOMEDSImpl_UseCaseBuilder) GetUseCaseBuilder(); + Standard_EXPORT virtual SALOMEDSImpl_UseCaseBuilder* GetUseCaseBuilder(); Standard_EXPORT virtual void Close(); Standard_EXPORT void EnableUseCaseAutoFilling(bool 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 std::string 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 SALOMEDSImpl_SComponent GetSComponent(const std::string& theEntry); + Standard_EXPORT virtual SALOMEDSImpl_SComponent GetSComponent(const DF_Label& theLabel); + Standard_EXPORT virtual SALOMEDSImpl_SObject GetSObject(const std::string& theEntry); + Standard_EXPORT virtual SALOMEDSImpl_SObject GetSObject(const DF_Label& theEntryLabel); + Standard_EXPORT virtual DF_Attribute* GetAttribute(const std::string& theEntry, + const std::string& theType); Standard_EXPORT virtual bool HasCurrentContext() { return !_current.IsNull(); } - Standard_EXPORT virtual bool DumpStudy(const TCollection_AsciiString& thePath, - const TCollection_AsciiString& theBaseName, + Standard_EXPORT virtual bool DumpStudy(const std::string& thePath, + const std::string& theBaseName, bool isPublished, SALOMEDSImpl_DriverFactory* theFactory); - Standard_EXPORT static TCollection_AsciiString GetDumpStudyComment(const char* theComponentName = 0); + Standard_EXPORT static std::string GetDumpStudyComment(const char* theComponentName = 0); - Standard_EXPORT virtual Handle(TDocStd_Document) GetDocument() { return _doc; } + Standard_EXPORT virtual DF_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); + Standard_EXPORT void dump(const std::string& theFileName); //This method marks the study as being modified Standard_EXPORT void Modify(); - Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetCommonParameters(const char* theID, int theSavePoint); + Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetCommonParameters(const char* theID, int theSavePoint); - Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetModuleParameters(const char* theID, + Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetModuleParameters(const char* theID, const char* theModuleName, int theSavePoint); @@ -277,14 +248,14 @@ public: Standard_EXPORT void UnLockStudy(const char* theLockerID); //Returns an ID of the study locker - Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetLockerID(); + Standard_EXPORT std::vector GetLockerID(); //Returns a callback - Standard_EXPORT Handle(SALOMEDSImpl_Callback) GetCallback() { return _cb; } + Standard_EXPORT SALOMEDSImpl_Callback* GetCallback() { return _cb; } + //Returns a list of IOR's stored in the study + Standard_EXPORT std::vector GetIORs(); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study ) friend class SALOMEDSImpl_StudyManager; friend class SALOMEDSImpl_GenericAttribute; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index 9b06d1d0f..eeeed8ac1 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -24,47 +24,37 @@ #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 "SALOMEDSImpl_ChildNodeIterator.hxx" -#include - -#include -#include -#include -#include -#include - -#include +#include "DF_ChildIterator.hxx" +#include "DF_Label.hxx" #include #include -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyBuilder, MMgt_TShared ) +using namespace std; #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); +static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII); //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner) +SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner) { _errorCode = ""; - _study = theOwner; - _doc = Handle(SALOMEDSImpl_Study)::DownCast(theOwner)->GetDocument(); + _study = (SALOMEDSImpl_Study*)theOwner; + _doc = _study->GetDocument(); } //============================================================================ @@ -80,31 +70,33 @@ SALOMEDSImpl_StudyBuilder::~SALOMEDSImpl_StudyBuilder() * Purpose : Create a new component (Scomponent) */ //============================================================================ -Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_StudyBuilder::NewComponent(const TCollection_AsciiString& DataType) +SALOMEDSImpl_SComponent SALOMEDSImpl_StudyBuilder::NewComponent(const string& DataType) { _errorCode = ""; CheckLocked(); - if(DataType.Length() == 0) return 0; + SALOMEDSImpl_SComponent sco; + + if(DataType.size() == 0) return sco; //Always create component under main label. - TDF_Label L = _doc->Main(); + DF_Label L = _doc->Main(); int imax = 0; - for (TDF_ChildIterator it(L); it.More(); it.Next()) { + for (DF_ChildIterator it(L); it.More(); it.Next()) { if (it.Value().Tag() > imax) imax = it.Value().Tag(); } imax++; - TDF_Label NL = L.FindChild(imax); + DF_Label NL = L.FindChild(imax); SALOMEDSImpl_AttributeComment::Set(NL, DataType); - Handle(SALOMEDSImpl_SComponent) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSComponent (NL); + SALOMEDSImpl_SComponent so = _study->GetSComponent (NL); - if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so); + if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so); - _doc->Modify(); + _doc->SetModified(true); return so; } @@ -114,20 +106,18 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_StudyBuilder::NewComponent(const TC * Purpose : Add IOR attribute of a Scomponent */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const Handle(SALOMEDSImpl_SComponent)& aComponent, - const TCollection_AsciiString& IOR) +bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const SALOMEDSImpl_SComponent& aComponent, + const string& IOR) { _errorCode = ""; CheckLocked(); - if(aComponent.IsNull() || IOR.IsEmpty()) { + if(!aComponent || IOR.empty()) { _errorCode = "Invalid arguments"; return false; } //add IOR definition - SALOMEDSImpl_AttributeIOR::Set(aComponent->GetLabel(), IOR); - - //_doc->Modify(); + SALOMEDSImpl_AttributeIOR::Set(aComponent.GetLabel(), IOR); return true; } @@ -137,7 +127,7 @@ bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const Handle(SALOMEDSImp * Purpose : Delete a Scomponent */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent) +bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const SALOMEDSImpl_SComponent& aComponent) { _errorCode = ""; CheckLocked(); @@ -149,27 +139,27 @@ bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const Handle(SALOMEDSImpl_SCompo * Purpose : Create a new SObject */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject) +SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObject(const SALOMEDSImpl_SObject& theFatherObject) { _errorCode = ""; CheckLocked(); //Find label of father - TDF_Label Lab = theFatherObject->GetLabel(); + DF_Label Lab = theFatherObject.GetLabel(); //Create a new label int imax = 0; - for (TDF_ChildIterator it(Lab); it.More(); it.Next()) { + for (DF_ChildIterator it(Lab); it.More(); it.Next()) { if (it.Value().Tag() > imax) imax = it.Value().Tag(); } imax++; - TDF_Label NewLab = Lab.FindChild(imax); + DF_Label NewLab = Lab.FindChild(imax); - Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab); - if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so); + SALOMEDSImpl_SObject so = _study->GetSObject(NewLab); + if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so); - _doc->Modify(); + _doc->SetModified(true); return so; } @@ -178,22 +168,22 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObject(const Handle(S * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject, - const int theTag) +SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject, + const int theTag) { _errorCode = ""; CheckLocked(); //Find label of father - TDF_Label Lab = theFatherObject->GetLabel(); + DF_Label Lab = theFatherObject.GetLabel(); //Create or find label - TDF_Label NewLab = Lab.FindChild(theTag, 1); + DF_Label NewLab = Lab.FindChild(theTag, 1); - Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab); + SALOMEDSImpl_SObject so = _study->GetSObject(NewLab); - if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so); + if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so); - _doc->Modify(); + _doc->SetModified(true); return so; } @@ -202,33 +192,33 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObjectToTag(const Han * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject) +bool SALOMEDSImpl_StudyBuilder::RemoveObject(const SALOMEDSImpl_SObject& anObject) { _errorCode = ""; CheckLocked(); - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Null object"; return false; } - if(!_callbackOnRemove.IsNull()) _callbackOnRemove->OnRemoveSObject(anObject); + if(_callbackOnRemove) _callbackOnRemove->OnRemoveSObject(anObject); - TDF_Label Lab = anObject->GetLabel(); + DF_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)) + SALOMEDSImpl_AttributeReference* aReference = NULL; + if ((aReference=(SALOMEDSImpl_AttributeReference*)Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { + SALOMEDSImpl_AttributeTarget* aTarget = NULL; + if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) 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()); + SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + } Lab.ForgetAllAttributes(); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -238,45 +228,45 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObject(const Handle(SALOMEDSImpl_SObject)& * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject) +bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject) { _errorCode = ""; CheckLocked(); - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Null object"; return false; } - if(!_callbackOnRemove.IsNull()) _callbackOnRemove->OnRemoveSObject(anObject); + if(_callbackOnRemove) _callbackOnRemove->OnRemoveSObject(anObject); - TDF_Label Lab = anObject->GetLabel(); + DF_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)) + SALOMEDSImpl_AttributeReference* aReference = NULL; + if ((aReference=(SALOMEDSImpl_AttributeReference*)Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { + SALOMEDSImpl_AttributeTarget* aTarget = NULL; + if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) 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()); + SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + } - TDF_ChildIterator it(Lab, Standard_True); + DF_ChildIterator it(Lab, 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)) + DF_Label aLabel = it.Value(); + if ((aReference=(SALOMEDSImpl_AttributeReference*)aLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { + SALOMEDSImpl_AttributeTarget* aTarget = NULL; + if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) 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()); + SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + } } - Lab.ForgetAllAttributes(Standard_True); + Lab.ForgetAllAttributes(true); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -286,25 +276,25 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const Handle(SALOMEDSIm * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& anSCO, +bool SALOMEDSImpl_StudyBuilder::LoadWith(const SALOMEDSImpl_SComponent& anSCO, SALOMEDSImpl_Driver* aDriver) { _errorCode = ""; - TDF_Label Lab = anSCO->GetLabel(); - Handle(SALOMEDSImpl_AttributePersistentRef) Att; + DF_Label Lab = anSCO.GetLabel(); + SALOMEDSImpl_AttributePersistentRef* Att = NULL; //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); + if ((Att=(SALOMEDSImpl_AttributePersistentRef*)_doc->Main().FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) { + int aLocked = _study->GetProperties()->IsLocked(); + if (aLocked) _study->GetProperties()->SetLocked(false); - TCollection_ExtendedString Res(Att->Value()); - TCollection_AsciiString aHDFPath(Res); + std::string Res(Att->Value()); + string aHDFPath(Res); - Handle(SALOMEDSImpl_AttributeComment) type; - TCollection_ExtendedString DataType; - if (Lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type)) + SALOMEDSImpl_AttributeComment* type = NULL; + std::string DataType; + if ((type=(SALOMEDSImpl_AttributeComment*)Lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) DataType = type->Value(); // associate the driver to the SComponent @@ -314,35 +304,35 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& } // 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); + SALOMEDSImpl_AttributeIOR* attrIOR = NULL; + if ((attrIOR=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + if (aLocked) _study->GetProperties()->SetLocked(true); return true; } DefineComponentInstance (anSCO, aDriver->GetIOR()); - TCollection_AsciiString aHDFUrl; + string aHDFUrl; bool isASCII = false; - if (HDFascii::isASCII(aHDFPath.ToCString())) { + if (HDFascii::isASCII(aHDFPath.c_str())) { isASCII = true; - aHDFUrl = HDFascii::ConvertFromASCIIToHDF(aHDFPath.ToCString()); + aHDFUrl = HDFascii::ConvertFromASCIIToHDF(aHDFPath.c_str()); aHDFUrl += "hdf_from_ascii.hdf"; } else { aHDFUrl = aHDFPath; } //Open the Study HDF file - HDFfile *hdf_file = new HDFfile(aHDFUrl.ToCString()); + HDFfile *hdf_file = new HDFfile((char*)aHDFUrl.c_str()); - char aMultifileState[2] = "S"; // default: single - char ASCIIfileState[2] = "B"; // default: binary + char aMultifileState[2]; + char ASCIIfileState[2]; try { - TCollection_AsciiString scoid = anSCO->GetID(); + string 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); + HDFgroup *hdf_sco_group = new HDFgroup((char*)scoid.c_str(), hdf_group); hdf_sco_group->OpenOnDisk(); unsigned char* aStreamFile = NULL; @@ -357,43 +347,22 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& hdf_dataset->ReadFromDisk(aStreamFile); hdf_dataset->CloseOnDisk(); hdf_dataset = 0; - } - else + } else aStreamFile = NULL; - if (hdf_sco_group->ExistInternalObject("MULTIFILE_STATE")) { - HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group); - multifile_hdf_dataset->OpenOnDisk(); - multifile_hdf_dataset->ReadFromDisk(aMultifileState); + HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group); + multifile_hdf_dataset->OpenOnDisk(); + multifile_hdf_dataset->ReadFromDisk(aMultifileState); - multifile_hdf_dataset->CloseOnDisk(); - multifile_hdf_dataset = 0; - } + HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group); + ascii_hdf_dataset->OpenOnDisk(); + ascii_hdf_dataset->ReadFromDisk(ASCIIfileState); - if (hdf_sco_group->ExistInternalObject("ASCII_STATE")) { - HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group); - ascii_hdf_dataset->OpenOnDisk(); - ascii_hdf_dataset->ReadFromDisk(ASCIIfileState); - - ascii_hdf_dataset->CloseOnDisk(); - ascii_hdf_dataset = 0; - } - - // 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; - //} - // Above code was working wrong for paths without '/' inside. - TCollection_AsciiString aDir = SALOMEDSImpl_Tool::GetDirFromPath(Res); + string aDir = SALOMEDSImpl_Tool::GetDirFromPath(Res); bool aResult = (ASCIIfileState[0]=='A')? - aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir.ToCString(), aMultifileState[0]=='M'): - aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir.ToCString(), aMultifileState[0]=='M'); + aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir.c_str(), aMultifileState[0]=='M'): + aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir.c_str(), aMultifileState[0]=='M'); if(aStreamFile != NULL) delete []aStreamFile; @@ -406,6 +375,11 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& //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(); @@ -414,8 +388,8 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& delete hdf_file; if (isASCII) { - Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString; - aFilesToRemove->Append("hdf_from_ascii.hdf"); + vector aFilesToRemove; + aFilesToRemove.push_back("hdf_from_ascii.hdf"); SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true); } @@ -424,13 +398,12 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& delete hdf_file; if (isASCII) { - Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString; - aFilesToRemove->Append(aHDFUrl); - SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), - aFilesToRemove, true); + vector aFilesToRemove; + aFilesToRemove.push_back(aHDFUrl); + SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true); } - if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true); + if (aLocked) _study->GetProperties()->SetLocked(true); _errorCode = "No persistent file"; return false; } @@ -442,7 +415,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& return false; } - if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true); + if (aLocked) _study->GetProperties()->SetLocked(true); } else { _errorCode = "No persistent file"; } @@ -456,7 +429,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::Load(const Handle(SALOMEDSImpl_SObject)& sco) +bool SALOMEDSImpl_StudyBuilder::Load(const SALOMEDSImpl_SObject& sco) { _errorCode = "Not implemented"; return false; @@ -468,69 +441,53 @@ bool SALOMEDSImpl_StudyBuilder::Load(const Handle(SALOMEDSImpl_SObject)& sco) * existing one */ //============================================================================ -Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, - const TCollection_AsciiString& aTypeOfAttribute) +DF_Attribute* SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject, + const string& aTypeOfAttribute) { _errorCode = ""; - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Invalid arguments"; return NULL; } - TDF_Label Lab = anObject->GetLabel(); + DF_Label Lab = anObject.GetLabel(); if(Lab.IsNull()) { _errorCode = "Null label"; return NULL; } - _doc->Modify(); + _doc->SetModified(true); //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 ) { + if (strncmp(aTypeOfAttribute.c_str(), "AttributeTreeNode",17) == 0 ) { - Standard_GUID aTreeNodeGUID; - if (strcmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode") == 0) { + string aTreeNodeGUID; + if (strcmp(aTypeOfAttribute.c_str(), "AttributeTreeNode") == 0) { aTreeNodeGUID = SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID(); } else { - char* aGUIDString = new char[41]; - char* aType = (char*)aTypeOfAttribute.ToCString(); - sprintf(aGUIDString, &(aType[17])); - if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) { - delete(aGUIDString); - return NULL; - } - aTreeNodeGUID = Standard_GUID(aGUIDString); // create tree node GUID by name - delete(aGUIDString); + aTreeNodeGUID = aTypeOfAttribute.substr(21, aTypeOfAttribute.size()); // create tree node GUID by name } - Handle(SALOMEDSImpl_AttributeTreeNode) anAttr; - if (!Lab.FindAttribute(aTreeNodeGUID, anAttr)) { + SALOMEDSImpl_AttributeTreeNode* anAttr = NULL; + if (!(anAttr=(SALOMEDSImpl_AttributeTreeNode*)Lab.FindAttribute(aTreeNodeGUID))) { CheckLocked(); anAttr = SALOMEDSImpl_AttributeTreeNode::Set(Lab, aTreeNodeGUID); } return anAttr; } - if (strncmp(aTypeOfAttribute.ToCString(), "AttributeUserID",15) == 0 ) { - Standard_GUID aUserGUID; - if (strcmp(aTypeOfAttribute.ToCString(), "AttributeUserID") == 0) { + if (strncmp(aTypeOfAttribute.c_str(), "AttributeUserID",15) == 0 ) { + std::string aUserGUID; + if (strcmp(aTypeOfAttribute.c_str(), "AttributeUserID") == 0) { aUserGUID = SALOMEDSImpl_AttributeUserID::DefaultID(); } else { - char* aGUIDString = new char[41]; - char* aType = (char*)aTypeOfAttribute.ToCString(); - sprintf(aGUIDString, &(aType[15])); - if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) { - delete(aGUIDString); - return NULL; - } - aUserGUID = Standard_GUID(aGUIDString); // create tree node GUID by name - delete(aGUIDString); + aUserGUID = aTypeOfAttribute.substr(15, aTypeOfAttribute.size()); // create tree node GUID by name } - Handle(SALOMEDSImpl_AttributeUserID) anAttr; - if (!Lab.FindAttribute(SALOMEDSImpl_AttributeUserID::DefaultID(), anAttr)) { + SALOMEDSImpl_AttributeUserID* anAttr = NULL; + if (!(anAttr=(SALOMEDSImpl_AttributeUserID*)Lab.FindAttribute(aUserGUID))) { CheckLocked(); anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, aUserGUID); } @@ -547,22 +504,22 @@ Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Han */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, - Handle(TDF_Attribute)& anAttribute, - const TCollection_AsciiString& aTypeOfAttribute) +bool SALOMEDSImpl_StudyBuilder::FindAttribute(const SALOMEDSImpl_SObject& anObject, + DF_Attribute*& anAttribute, + const string& aTypeOfAttribute) { _errorCode = ""; - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Invalid arguments"; return false; } - TDF_Label Lab = anObject->GetLabel(); - if (Lab.FindAttribute(SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute), anAttribute)) { + DF_Label Lab = anObject.GetLabel(); + if ((anAttribute=Lab.FindAttribute(SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute)))) { // commented out because NO MODIFICATION is done to attributes when calling FindAttribute() // _doc->Modify(); - return Standard_True; + return true; } - return Standard_False; + return false; } //============================================================================ @@ -571,26 +528,26 @@ bool SALOMEDSImpl_StudyBuilder::FindAttribute(const Handle(SALOMEDSImpl_SObject) */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, - const TCollection_AsciiString& aTypeOfAttribute) +bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const SALOMEDSImpl_SObject& anObject, + const string& aTypeOfAttribute) { _errorCode = ""; CheckLocked(); - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Invalid arguments"; return false; } - TDF_Label Lab = anObject->GetLabel(); + DF_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()); + if (aTypeOfAttribute == string("AttributeIOR")) { // Remove from IORLabel map + SALOMEDSImpl_AttributeIOR* anAttr = NULL; + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + } } Lab.ForgetAttribute (SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute)); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -600,22 +557,22 @@ bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const Handle(SALOMEDSImpl_SObjec * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::Addreference(const Handle(SALOMEDSImpl_SObject)& me, - const Handle(SALOMEDSImpl_SObject)& theReferencedObject) +bool SALOMEDSImpl_StudyBuilder::Addreference(const SALOMEDSImpl_SObject& me, + const SALOMEDSImpl_SObject& theReferencedObject) { _errorCode = ""; - if(me.IsNull() || theReferencedObject.IsNull()) { + if(!me || !theReferencedObject) { _errorCode = "Invalid arguments"; return false; } CheckLocked(); - TDF_Label Lab = me->GetLabel(); - TDF_Label RefLab = theReferencedObject->GetLabel(); + DF_Label Lab = me.GetLabel(); + DF_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); + if(_callbackOnRemove && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me); return true; } @@ -625,26 +582,28 @@ bool SALOMEDSImpl_StudyBuilder::Addreference(const Handle(SALOMEDSImpl_SObject)& * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::RemoveReference(const Handle(SALOMEDSImpl_SObject)& me) +bool SALOMEDSImpl_StudyBuilder::RemoveReference(const SALOMEDSImpl_SObject& me) { _errorCode = ""; - Handle(SALOMEDSImpl_SObject) theReferencedObject; - if(!me->ReferencedObject(theReferencedObject)) return false; //No reference is found - + SALOMEDSImpl_SObject theReferencedObject; + + if(!me.ReferencedObject(theReferencedObject)) return false; //No reference is found + CheckLocked(); - TDF_Label Lab = me->GetLabel(); - - Lab.ForgetAttribute(SALOMEDSImpl_AttributeReference::GetID()); + DF_Label Lab = me.GetLabel(); //SRN: 30 Aug, 2004 : fix from Ecole l'ete version - TDF_Label RefLab = theReferencedObject->GetLabel(); + DF_Label RefLab = theReferencedObject.GetLabel(); - Handle(SALOMEDSImpl_AttributeTarget) aTarget; - if(RefLab.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget)) + SALOMEDSImpl_AttributeTarget* aTarget = NULL; + if((aTarget=(SALOMEDSImpl_AttributeTarget*)RefLab.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) { aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab)); + } - _doc->Modify(); + Lab.ForgetAttribute(SALOMEDSImpl_AttributeReference::GetID()); + + _doc->SetModified(true); return true; } @@ -656,70 +615,66 @@ bool SALOMEDSImpl_StudyBuilder::RemoveReference(const Handle(SALOMEDSImpl_SObjec * Purpose : adds a new directory with a path = thePath */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::AddDirectory(const TCollection_AsciiString& thePath) +bool SALOMEDSImpl_StudyBuilder::AddDirectory(const string& thePath) { _errorCode = ""; CheckLocked(); - if(thePath.IsEmpty() || thePath == "") { + if(thePath.empty()) { _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; + string aPath(thePath), aContext(""), aFatherPath; + DF_Label aLabel; + SALOMEDSImpl_SObject anObject; try { - anObject = aStudy->FindObjectByPath(thePath); //Check if the directory already exists + anObject = _study->FindObjectByPath(thePath); //Check if the directory already exists } catch(...) { } - if(!anObject.IsNull()) { + if(anObject) { _errorCode = "StudyNameAlreadyUsed"; return false; } - if(aPath.Value(1) != '/') { //Relative path - aPath.Prepend('/'); - aPath = aStudy->GetContext() + aPath; + if(aPath[0] != '/') { //Relative path + aPath.insert(aPath.begin(), '/'); + aPath = _study->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) { + vector vs = SALOMEDSImpl_Tool::splitString(aPath, '/'); + if(vs.size() == 1) + aFatherPath = "/"; + else { + for(int i = 0, len = vs.size()-1; iFindObjectByPath(aFatherPath); //Check if the father directory exists + anObject = _study->FindObjectByPath(aFatherPath); //Check if the father directory exists } catch(...) { ; } - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "StudyInvalidDirectory"; return false; } - Handle(SALOMEDSImpl_SObject) aNewObject = NewObject(anObject); - aLabel = aNewObject->GetLabel(); + SALOMEDSImpl_SObject aNewObject = NewObject(anObject); + aLabel = aNewObject.GetLabel(); if(aLabel.IsNull()) { _errorCode = "StudyInvalidComponent"; return false; } - SALOMEDSImpl_AttributeName::Set(aLabel, aPath.Token("/", i-1)); + SALOMEDSImpl_AttributeName::Set(aLabel, vs.back()); //Set LocalID attribute to identify the directory object - Handle(SALOMEDSImpl_AttributeLocalID) aLocalID = SALOMEDSImpl_AttributeLocalID::Set(aLabel, DIRECTORYID); + SALOMEDSImpl_AttributeLocalID::Set(aLabel, DIRECTORYID); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -730,20 +685,20 @@ bool SALOMEDSImpl_StudyBuilder::AddDirectory(const TCollection_AsciiString& theP * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject, - const TCollection_AsciiString& theGUID) +bool SALOMEDSImpl_StudyBuilder::SetGUID(const SALOMEDSImpl_SObject& anObject, + const string& theGUID) { _errorCode = ""; CheckLocked(); - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Invalid arguments"; return false; } - TDF_Label aLabel = anObject->GetLabel(); - SALOMEDSImpl_AttributeUserID::Set(aLabel, theGUID.ToCString()); + DF_Label aLabel = anObject.GetLabel(); + SALOMEDSImpl_AttributeUserID::Set(aLabel, theGUID); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -753,16 +708,16 @@ bool SALOMEDSImpl_StudyBuilder::SetGUID(const Handle(SALOMEDSImpl_SObject)& anOb * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject, - const TCollection_AsciiString& theGUID) +bool SALOMEDSImpl_StudyBuilder::IsGUID(const SALOMEDSImpl_SObject& anObject, + const string& theGUID) { _errorCode = ""; - if(anObject.IsNull()) { + if(!anObject) { _errorCode = "Invalid arguments"; return false; } - TDF_Label aLabel = anObject->GetLabel(); - return aLabel.IsAttribute(theGUID.ToCString()); + DF_Label aLabel = anObject.GetLabel(); + return aLabel.IsAttribute(theGUID); } @@ -774,15 +729,11 @@ bool SALOMEDSImpl_StudyBuilder::IsGUID(const Handle(SALOMEDSImpl_SObject)& anObj 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(); + _study->GetProperties()->IsLockChanged(true); + + //Not implemented } //============================================================================ @@ -793,25 +744,19 @@ void SALOMEDSImpl_StudyBuilder::NewCommand() 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); - } + SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties(); 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(); + + //Not implemented + _doc->SetModified(true); } //============================================================================ @@ -822,7 +767,9 @@ void SALOMEDSImpl_StudyBuilder::CommitCommand() bool SALOMEDSImpl_StudyBuilder::HasOpenCommand() { _errorCode = ""; - return _doc->HasOpenCommand(); + + //Not implememnted + return false; } //============================================================================ @@ -833,9 +780,7 @@ bool SALOMEDSImpl_StudyBuilder::HasOpenCommand() void SALOMEDSImpl_StudyBuilder::AbortCommand() { _errorCode = ""; - SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(0); - - _doc->AbortCommand(); + //Not implemented } //============================================================================ @@ -845,22 +790,17 @@ void SALOMEDSImpl_StudyBuilder::AbortCommand() //============================================================================ void SALOMEDSImpl_StudyBuilder::Undo() { + //Not implemented _errorCode = ""; - Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr; - if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) { - anAttr = new SALOMEDSImpl_AttributeStudyProperties; - _doc->Main().AddAttribute(anAttr); - } + SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties(); 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(); + _doc->SetModified(true); } //============================================================================ @@ -871,22 +811,17 @@ void SALOMEDSImpl_StudyBuilder::Undo() 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); - } - + SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties(); 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(); + + //Not implemented + + _doc->SetModified(true); } //============================================================================ @@ -897,7 +832,7 @@ void SALOMEDSImpl_StudyBuilder::Redo() bool SALOMEDSImpl_StudyBuilder::GetAvailableUndos() { _errorCode = ""; - return _doc->GetAvailableUndos(); + return false; } //============================================================================ @@ -908,7 +843,7 @@ bool SALOMEDSImpl_StudyBuilder::GetAvailableUndos() bool SALOMEDSImpl_StudyBuilder::GetAvailableRedos() { _errorCode = ""; - return _doc->GetAvailableRedos(); + return false; } //============================================================================ @@ -919,7 +854,7 @@ bool SALOMEDSImpl_StudyBuilder::GetAvailableRedos() int SALOMEDSImpl_StudyBuilder::UndoLimit() { _errorCode = ""; - return _doc->GetUndoLimit(); + return 1; } //============================================================================ @@ -931,7 +866,7 @@ void SALOMEDSImpl_StudyBuilder::UndoLimit(int n) { _errorCode = ""; CheckLocked(); - _doc->SetUndoLimit (n); + //Not implemented } //============================================================================ @@ -939,12 +874,12 @@ void SALOMEDSImpl_StudyBuilder::UndoLimit(int n) * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_Callback) -SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback) +SALOMEDSImpl_Callback* +SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback) { _errorCode = ""; - Handle(SALOMEDSImpl_Callback) aRet = _callbackOnAdd; - _callbackOnAdd = theCallback; + SALOMEDSImpl_Callback* aRet = _callbackOnAdd; + _callbackOnAdd = (SALOMEDSImpl_Callback*)theCallback; return aRet; } @@ -953,12 +888,12 @@ SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_Callback) -SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback) +SALOMEDSImpl_Callback* +SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback) { _errorCode = ""; - Handle(SALOMEDSImpl_Callback) aRet = _callbackOnRemove; - _callbackOnRemove = theCallback; + SALOMEDSImpl_Callback* aRet = _callbackOnRemove; + _callbackOnRemove = (SALOMEDSImpl_Callback*)theCallback; return aRet; } @@ -970,12 +905,8 @@ SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback 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 (HasOpenCommand()) return; + SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties(); if (anAttr->IsLocked()) { _errorCode = "LockProtection"; throw LockProtection("LockProtection"); @@ -987,18 +918,18 @@ void SALOMEDSImpl_StudyBuilder::CheckLocked() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::SetName(const Handle(SALOMEDSImpl_SObject)& theSO, - const TCollection_AsciiString& theValue) +bool SALOMEDSImpl_StudyBuilder::SetName(const SALOMEDSImpl_SObject& theSO, + const string& theValue) { _errorCode = ""; CheckLocked(); - if(theSO.IsNull()) { + if(!theSO) { _errorCode = "Invalid arguments"; return false; } - SALOMEDSImpl_AttributeName::Set(theSO->GetLabel(), theValue); + SALOMEDSImpl_AttributeName::Set(theSO.GetLabel(), theValue); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -1008,18 +939,18 @@ bool SALOMEDSImpl_StudyBuilder::SetName(const Handle(SALOMEDSImpl_SObject)& theS * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::SetComment(const Handle(SALOMEDSImpl_SObject)& theSO, - const TCollection_AsciiString& theValue) +bool SALOMEDSImpl_StudyBuilder::SetComment(const SALOMEDSImpl_SObject& theSO, + const string& theValue) { _errorCode = ""; CheckLocked(); - if(theSO.IsNull()) { + if(!theSO) { _errorCode = "Invalid arguments"; return false; } - SALOMEDSImpl_AttributeComment::Set(theSO->GetLabel(), theValue); + SALOMEDSImpl_AttributeComment::Set(theSO.GetLabel(), theValue); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -1029,18 +960,18 @@ bool SALOMEDSImpl_StudyBuilder::SetComment(const Handle(SALOMEDSImpl_SObject)& t * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyBuilder::SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO, - const TCollection_AsciiString& theValue) +bool SALOMEDSImpl_StudyBuilder::SetIOR(const SALOMEDSImpl_SObject& theSO, + const string& theValue) { _errorCode = ""; CheckLocked(); - if(theSO.IsNull()) { + if(!theSO) { _errorCode = "Invalid arguments"; return false; } - SALOMEDSImpl_AttributeIOR::Set(theSO->GetLabel(), theValue); + SALOMEDSImpl_AttributeIOR::Set(theSO.GetLabel(), theValue); - _doc->Modify(); + _doc->SetModified(true); return true; } @@ -1051,26 +982,26 @@ bool SALOMEDSImpl_StudyBuilder::SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO * Purpose : */ //============================================================================ -static void Translate_persistentID_to_IOR(TDF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII) +static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII) { if(driver == NULL) return; - TDF_ChildIterator itchild (Lab); + DF_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); + DF_Label current = itchild.Value(); + SALOMEDSImpl_AttributePersistentRef* Att = NULL; + if ((Att=(SALOMEDSImpl_AttributePersistentRef*)current.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) { + + SALOMEDSImpl_AttributeLocalID* anID = NULL; + if ((anID=(SALOMEDSImpl_AttributeLocalID*)current.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) + if (anID->Value() == FILELOCALID) continue; //SRN: This attribute store a file name, skip it + + string persist_ref = Att->Value(); + SALOMEDSImpl_SObject so = SALOMEDSImpl_Study::SObject(current); + string ior_string = driver->LocalPersistentIDToIOR(so, + persist_ref, + isMultiFile, + isASCII); SALOMEDSImpl_AttributeIOR::Set (current, ior_string); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.hxx index d83edd6ea..781103cb6 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.hxx @@ -24,71 +24,66 @@ #ifndef __SALOMEDSImpl_STUDYBUILDER_H__ #define __SALOMEDSImpl_STUDYBUILDER_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared ) - // std C++ headers #include - -// Cascade header -#include -#include +#include +#include #include "SALOMEDSImpl_Callback.hxx" #include "SALOMEDSImpl_Driver.hxx" -class SALOMEDSImpl_StudyBuilder : public MMgt_TShared +class SALOMEDSImpl_Study; + +class SALOMEDSImpl_StudyBuilder { private: - Handle(TDocStd_Document) _doc; - Handle(Standard_Transient) _study; - Handle(SALOMEDSImpl_Callback) _callbackOnAdd; - Handle(SALOMEDSImpl_Callback) _callbackOnRemove; - TCollection_AsciiString _errorCode; + DF_Document* _doc; + SALOMEDSImpl_Study* _study; + SALOMEDSImpl_Callback* _callbackOnAdd; + SALOMEDSImpl_Callback* _callbackOnRemove; + std::string _errorCode; public: - Standard_EXPORT SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner); + Standard_EXPORT SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner); Standard_EXPORT ~SALOMEDSImpl_StudyBuilder(); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) NewComponent(const TCollection_AsciiString& ComponentDataType); + Standard_EXPORT virtual SALOMEDSImpl_SComponent NewComponent(const std::string& ComponentDataType); - Standard_EXPORT virtual bool DefineComponentInstance (const Handle(SALOMEDSImpl_SComponent)&, const TCollection_AsciiString& ComponentIOR); + Standard_EXPORT virtual bool DefineComponentInstance (const SALOMEDSImpl_SComponent&, const std::string& ComponentIOR); - Standard_EXPORT virtual bool RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent); + Standard_EXPORT virtual bool RemoveComponent(const SALOMEDSImpl_SComponent& aComponent); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject); + Standard_EXPORT virtual SALOMEDSImpl_SObject NewObject(const SALOMEDSImpl_SObject& theFatherObject); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject, - const int theTag); + Standard_EXPORT virtual SALOMEDSImpl_SObject NewObjectToTag(const 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 AddDirectory(const std::string& 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 LoadWith(const SALOMEDSImpl_SComponent& sco, SALOMEDSImpl_Driver* Engine); + Standard_EXPORT virtual bool Load(const 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 bool RemoveObject(const SALOMEDSImpl_SObject& anObject); + Standard_EXPORT virtual bool RemoveObjectWithChildren(const 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 DF_Attribute* FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject, + const std::string& aTypeOfAttribute); + Standard_EXPORT virtual bool FindAttribute(const SALOMEDSImpl_SObject& anObject, + DF_Attribute*& anAttribute, + const std::string& aTypeOfAttribute); - Standard_EXPORT virtual bool RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& aTypeOfAttribute); + Standard_EXPORT virtual bool RemoveAttribute(const SALOMEDSImpl_SObject& anObject, const std::string& aTypeOfAttribute); - Standard_EXPORT virtual bool Addreference(const Handle(SALOMEDSImpl_SObject)& me, - const Handle(SALOMEDSImpl_SObject)& thereferencedObject); + Standard_EXPORT virtual bool Addreference(const SALOMEDSImpl_SObject& me, + const SALOMEDSImpl_SObject& thereferencedObject); - Standard_EXPORT virtual bool RemoveReference(const Handle(SALOMEDSImpl_SObject)& me); + Standard_EXPORT virtual bool RemoveReference(const 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 bool SetGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID); + Standard_EXPORT virtual bool IsGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID); Standard_EXPORT virtual void NewCommand(); Standard_EXPORT virtual void CommitCommand(); @@ -105,21 +100,18 @@ public: 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 SALOMEDSImpl_Callback* SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback); + Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback); - Standard_EXPORT virtual bool SetName(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue); + Standard_EXPORT virtual bool SetName(const SALOMEDSImpl_SObject& theSO, const std::string& theValue); - Standard_EXPORT virtual bool SetComment(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue); + Standard_EXPORT virtual bool SetComment(const SALOMEDSImpl_SObject& theSO, const std::string& theValue); - Standard_EXPORT virtual bool SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue); + Standard_EXPORT virtual bool SetIOR(const SALOMEDSImpl_SObject& theSO, const std::string& theValue); - Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; } + Standard_EXPORT virtual std::string 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 ) + Standard_EXPORT virtual SALOMEDSImpl_Study* GetOwner() { return _study; } }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx index 2952d045d..7f0c1b261 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx @@ -22,8 +22,6 @@ // Module : SALOME #include "SALOMEDSImpl_StudyHandle.hxx" -#include -#include /* Class : SALOMEDSImpl_StudyHandle @@ -31,16 +29,14 @@ 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() +const std::string& SALOMEDSImpl_StudyHandle::GetID() { - static Standard_GUID SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" ); + static std::string SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" ); return SALOMEDSImpl_StudyHandleID; } @@ -50,23 +46,23 @@ const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID() //======================================================================= SALOMEDSImpl_StudyHandle::SALOMEDSImpl_StudyHandle() { - myHandle.Nullify(); + myHandle = NULL; } //======================================================================= //function : Set //purpose : //======================================================================= -Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& theLabel, - const Handle(SALOMEDSImpl_Study)& theStudy) +SALOMEDSImpl_StudyHandle* SALOMEDSImpl_StudyHandle::Set(const DF_Label& theLabel, + SALOMEDSImpl_Study* theStudy) { - Handle(SALOMEDSImpl_StudyHandle) A; - if (!theLabel.FindAttribute(GetID(), A)) { - A = new SALOMEDSImpl_StudyHandle(); + SALOMEDSImpl_StudyHandle* A = NULL; + if (!(A=(SALOMEDSImpl_StudyHandle*)theLabel.FindAttribute(GetID()))) { + A = new SALOMEDSImpl_StudyHandle; theLabel.AddAttribute(A); } - A->SetHandle(theStudy); + A->Set(theStudy); return A; } @@ -75,7 +71,7 @@ Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& //function : ID //purpose : Get GUID of this attribute //======================================================================= -const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const +const std::string& SALOMEDSImpl_StudyHandle::ID () const { return GetID(); } @@ -85,7 +81,7 @@ const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const //function : NewEmpty //purpose : Create new empty attribute //======================================================================= -Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const +DF_Attribute* SALOMEDSImpl_StudyHandle::NewEmpty () const { return new SALOMEDSImpl_StudyHandle (); } @@ -95,20 +91,19 @@ Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const //function : Restore //purpose : Restore value of attribute with value of theWith one //======================================================================= -void SALOMEDSImpl_StudyHandle::Restore( const Handle(TDF_Attribute)& theWith ) +void SALOMEDSImpl_StudyHandle::Restore( DF_Attribute* theWith ) { - Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theWith ); - if ( !anAttr.IsNull() ) SetHandle( anAttr->GetHandle() ); + SALOMEDSImpl_StudyHandle* anAttr = dynamic_cast( theWith ); + if ( anAttr ) Set ( anAttr->Get() ); } //======================================================================= //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 +void SALOMEDSImpl_StudyHandle::Paste( DF_Attribute* theInto) { - Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theInto ); - if ( !anAttr.IsNull() ) anAttr->SetHandle( myHandle ); + SALOMEDSImpl_StudyHandle* anAttr = dynamic_cast( theInto ); + if ( anAttr ) anAttr->Set ( myHandle ); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx index e74cac414..5d8cff6a2 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx @@ -24,50 +24,40 @@ #ifndef SALOMEDSImpl_StudyHandle_HeaderFile #define SALOMEDSImpl_StudyHandle_HeaderFile -#include -#include -#include - -class Standard_GUID; -class Handle(TDF_Attribute); -class Handle(TDF_RelocationTable); +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" /* 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 +class Standard_EXPORT SALOMEDSImpl_StudyHandle : public DF_Attribute #else -class SALOMEDSImpl_StudyHandle : public TDF_Attribute +class SALOMEDSImpl_StudyHandle : public DF_Attribute #endif { public: Standard_EXPORT SALOMEDSImpl_StudyHandle(); -Standard_EXPORT ~SALOMEDSImpl_StudyHandle() { myHandle.Nullify(); } +Standard_EXPORT ~SALOMEDSImpl_StudyHandle() {; } -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 static SALOMEDSImpl_StudyHandle* Set(const DF_Label& theLabel, SALOMEDSImpl_Study* theStudy); +Standard_EXPORT static const std::string& 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; +Standard_EXPORT void Set(SALOMEDSImpl_Study* theStudy) { myHandle = theStudy; } +Standard_EXPORT SALOMEDSImpl_Study* Get() { return myHandle; } +Standard_EXPORT const std::string& ID() const; +Standard_EXPORT void Restore( DF_Attribute* theWith ); +Standard_EXPORT DF_Attribute* NewEmpty() const; +Standard_EXPORT void Paste( DF_Attribute* theInto); private: - Handle(SALOMEDSImpl_Study) myHandle; + SALOMEDSImpl_Study* myHandle; -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyHandle ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index 20a0d49ab..428c5b636 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -23,27 +23,13 @@ #include "SALOMEDSImpl_StudyManager.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "DF_ChildIterator.hxx" #include "HDFexplorer.hxx" #include "SALOMEDSImpl_Attributes.hxx" #include "SALOMEDSImpl_Tool.hxx" #include "SALOMEDSImpl_SComponent.hxx" +#include "SALOMEDSImpl_GenericAttribute.hxx" #include #include "HDFOI.hxx" @@ -52,15 +38,12 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyManager, MMgt_TShared ) - #define USE_CASE_LABEL_ID "0:2" -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)&, +static void SaveAttributes(const SALOMEDSImpl_SObject& SO, HDFgroup *hdf_group_sobject); +static void ReadAttributes(SALOMEDSImpl_Study*, const SALOMEDSImpl_SObject&, HDFdataset* ); +static void BuildTree (SALOMEDSImpl_Study*, HDFgroup*); +static void Translate_IOR_to_persistentID (const SALOMEDSImpl_SObject&, SALOMEDSImpl_Driver*, bool isMultiFile, bool isASCII); //============================================================================ @@ -71,9 +54,9 @@ static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)&, SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager() { _errorCode = ""; - _OCAFApp = new SALOMEDSImpl_OCAFApplication(); + _appli = new DF_Application(); _IDcounter = 0; - _OCAFApp->NewDocument("SALOME_STUDY", _clipboard); + _clipboard = _appli->NewDocument("SALOME_STUDY"); } //============================================================================ @@ -83,8 +66,8 @@ SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager() //============================================================================ SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager() { - // Destroy OCAF application - _OCAFApp.Nullify(); + // Destroy application + delete _appli; } @@ -93,24 +76,24 @@ SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager() * Purpose : Create a New Study of name study_name */ //==================================================T========================== -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::NewStudy(const TCollection_AsciiString& study_name) +SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::NewStudy(const string& study_name) { _errorCode = ""; - Handle(TDocStd_Document) Doc; - _OCAFApp->NewDocument("SALOME_STUDY",Doc); + DF_Document* Doc = _appli->NewDocument("SALOME_STUDY"); - Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, study_name); + 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()); + SALOMEDSImpl_AttributeStudyProperties* aProp = Study->GetProperties(); + + int month=0,day=0,year=0,hh=0,mn=0,ss=0; + SALOMEDSImpl_Tool::GetSystemDate(year, month, day, hh, mn, ss); + aProp->SetModification(SALOMEDSImpl_Tool::GetUserName(), + mn, hh, day, month, year); aProp->SetCreationMode(1); //"from scratch" return Study; @@ -121,7 +104,7 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::NewStudy(const TCollection * Purpose : Open a Study from it's persistent reference */ //============================================================================ -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_AsciiString& aUrl) +SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const string& aUrl) { _errorCode = ""; @@ -130,11 +113,11 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc HDFgroup *hdf_group_study_structure =0; char* aC_HDFUrl; - TCollection_AsciiString aHDFUrl; + string aHDFUrl; bool isASCII = false; - if (HDFascii::isASCII(aUrl.ToCString())) { + if (HDFascii::isASCII(aUrl.c_str())) { isASCII = true; - char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.ToCString()); + char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.c_str()); aC_HDFUrl = new char[strlen(aResultPath) + 19]; sprintf(aC_HDFUrl, "%shdf_from_ascii.hdf", aResultPath); delete(aResultPath); @@ -144,7 +127,8 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc aHDFUrl = aUrl; } - hdf_file = new HDFfile((char*)aHDFUrl.ToCString()); + + hdf_file = new HDFfile((char*)aHDFUrl.c_str()); try { hdf_file->OpenOnDisk(HDF_RDONLY);// mpv: was RDWR, but opened file can be write-protected too } @@ -154,21 +138,20 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc // char eStr[strlen(aUrl.ToCString())+17]; //#else char *eStr; - eStr = new char[strlen(aUrl.ToCString())+17]; + eStr = new char[strlen(aUrl.c_str())+17]; //#endif - sprintf(eStr,"Can't open file %s",aUrl.ToCString()); + sprintf(eStr,"Can't open file %s",aUrl.c_str()); //#ifdef WNT delete [] eStr; //#endif - _errorCode = TCollection_AsciiString(eStr); + _errorCode = string(eStr); return NULL; } // Temporary aStudyUrl in place of study name - Handle(TDocStd_Document) Doc; - _OCAFApp->NewDocument("SALOME_STUDY",Doc); + DF_Document* Doc = _appli->NewDocument("SALOME_STUDY"); - Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, aUrl); + SALOMEDSImpl_Study* Study = new SALOMEDSImpl_Study(Doc, aUrl); _IDcounter++; Study->StudyId( _IDcounter ); @@ -183,10 +166,9 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc return Study; } - //Create the Structure of the OCAF Document + //Create the Structure of the Document hdf_group_study_structure = new HDFgroup("STUDY_STRUCTURE",hdf_file); - Handle(TDF_Data) DF = Doc->GetData(); try { BuildTree (Study, hdf_group_study_structure); } @@ -195,18 +177,18 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc //#ifndef WNT // char eStr[strlen(aUrl.ToCString())+17]; //#else - char *eStr = new char [strlen(aUrl.ToCString())+17]; + char *eStr = new char [strlen(aUrl.c_str())+17]; //#endif - sprintf(eStr,"Can't open file %s", aUrl.ToCString()); - _errorCode = TCollection_AsciiString(eStr); + sprintf(eStr,"Can't open file %s", aUrl.c_str()); + _errorCode = string(eStr); return NULL; } hdf_file->CloseOnDisk(); if (isASCII) { - Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString; - aFilesToRemove->Append("hdf_from_ascii.hdf"); + vector aFilesToRemove; + aFilesToRemove.push_back("hdf_from_ascii.hdf"); SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true); } @@ -225,11 +207,11 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_Asc */ //============================================================================ -void SALOMEDSImpl_StudyManager::Close(const Handle(SALOMEDSImpl_Study)& aStudy) +void SALOMEDSImpl_StudyManager::Close(SALOMEDSImpl_Study* aStudy) { _errorCode = ""; - if(aStudy.IsNull()) { + if(!aStudy) { _errorCode = "Study is null"; return; } @@ -242,14 +224,14 @@ void SALOMEDSImpl_StudyManager::Close(const Handle(SALOMEDSImpl_Study)& aStudy) * Purpose : Save a Study to it's persistent reference */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Save(const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { _errorCode = ""; - TCollection_AsciiString url = aStudy->URL(); - if (url.IsEmpty()) { + string url = aStudy->URL(); + if (url.empty()) { _errorCode = "No path specified to save the study. Nothing done"; return false; } @@ -260,14 +242,14 @@ bool SALOMEDSImpl_StudyManager::Save(const Handle(SALOMEDSImpl_Study)& aStudy, return false; } -bool SALOMEDSImpl_StudyManager::SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::SaveASCII(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { _errorCode = ""; - TCollection_AsciiString url = aStudy->URL(); - if (url.IsEmpty()) { + string url = aStudy->URL(); + if (url.empty()) { _errorCode = "No path specified to save the study. Nothing done"; return false; } @@ -283,8 +265,8 @@ bool SALOMEDSImpl_StudyManager::SaveASCII(const Handle(SALOMEDSImpl_Study)& aStu * Purpose : Save a study to the persistent reference aUrl */ //============================================================================ -bool SALOMEDSImpl_StudyManager::SaveAs(const TCollection_AsciiString& aUrl, - const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::SaveAs(const string& aUrl, + SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { @@ -292,8 +274,8 @@ bool SALOMEDSImpl_StudyManager::SaveAs(const TCollection_AsciiString& aUrl, return Impl_SaveAs(aUrl,aStudy, aFactory, theMultiFile, false); } -bool SALOMEDSImpl_StudyManager::SaveAsASCII(const TCollection_AsciiString& aUrl, - const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::SaveAsASCII(const string& aUrl, + SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile) { @@ -306,27 +288,26 @@ bool SALOMEDSImpl_StudyManager::SaveAsASCII(const TCollection_AsciiString& aUrl, * Purpose : Get name list of open studies in the session */ //============================================================================ -Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_StudyManager::GetOpenStudies() +vector SALOMEDSImpl_StudyManager::GetOpenStudies() { _errorCode = ""; - Handle(TColStd_HSequenceOfTransient) aList = new TColStd_HSequenceOfTransient; + vector aList; - int nbDocs = _OCAFApp->NbDocuments(); + int nbDocs = _appli->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()); + SALOMEDSImpl_Study* aStudy; + vector ids = _appli->GetDocumentIDs(); + for (int i = 0, len = ids.size(); iGetDocument(ids[i]); if(D == _clipboard) continue; aStudy = SALOMEDSImpl_Study::GetStudy(D->Main()); - if(aStudy.IsNull()) continue; - aList->Append(aStudy); + if(!aStudy) continue; + aList.push_back(aStudy); } } @@ -338,30 +319,24 @@ Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_StudyManager::GetOpenStudies() * Purpose : Get a study from its name */ //============================================================================ -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByName - (const TCollection_AsciiString& aStudyName) +SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::GetStudyByName + (const string& aStudyName) { _errorCode = ""; - int nbDocs = _OCAFApp->NbDocuments(); + int nbDocs = _appli->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; + vector studies = GetOpenStudies(); + for (int i = 0, len = studies.size(); iName() == aStudyName) return studies[i]; } } - _errorCode = TCollection_AsciiString("Found no study with the name ") + aStudyName; + _errorCode = string("Found no study with the name ") + aStudyName; return NULL; } @@ -370,25 +345,19 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByName * Purpose : Get a study from its ID */ //============================================================================ -Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID) +SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID) { _errorCode = ""; - int nbDocs = _OCAFApp->NbDocuments(); + int nbDocs = _appli->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; + vector studies = GetOpenStudies(); + for (int i = 0, len = studies.size(); iStudyId() == aStudyID) return studies[i]; } } @@ -401,7 +370,7 @@ Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID) * Purpose : save the study properties in HDF file */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group) { _errorCode = ""; @@ -411,43 +380,42 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_St hdf_int32 name_len; // add modifications list (user and date of save) - Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = aStudy->GetProperties(); - Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder(); + SALOMEDSImpl_AttributeStudyProperties* aProp = aStudy->GetProperties(); int aLocked = aProp->IsLocked(); - if (aLocked) aProp->SetLocked(Standard_False); + if (aLocked) aProp->SetLocked(false); - OSD_Process aProcess; - Quantity_Date aDate = aProcess.SystemDate(); - aProp->SetModification(aProcess.UserName().ToCString(), - aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year()); + int month=0,day=0,year=0,hh=0,mn=0,ss=0; + SALOMEDSImpl_Tool::GetSystemDate(year, month, day, hh, mn, ss); + aProp->SetModification(SALOMEDSImpl_Tool::GetUserName(), + mn, hh, day, month, year); - if (aLocked) aProp->SetLocked(Standard_True); + if (aLocked) aProp->SetLocked(true); - Handle(TColStd_HSequenceOfExtendedString) aNames; - Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears; + vector aNames; + vector 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; + for(i=1; i<=aNames.size(); i++) + aLength += aNames[i-1].size() + 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()]; + char* aProperty = new char[3 + aLength + 12 * aNames.size()]; sprintf(aProperty,"%c%c", (char)aProp->GetCreationMode(), (aProp->IsLocked())?'l':'u'); - aLength = aNames->Length(); + aLength = aNames.size(); int a = 2; - for(anIndex = 1; anIndex <= aLength; anIndex++) { + for(anIndex = 0; anIndexValue(anIndex)), - (int)(aHours->Value(anIndex)), - (int)(aDays->Value(anIndex)), - (int)(aMonths->Value(anIndex)), - (int)(aYears->Value(anIndex)), - TCollection_AsciiString(aNames->Value(anIndex)).ToCString()); + (int)(aMinutes[anIndex]), + (int)(aHours[anIndex]), + (int)(aDays[anIndex]), + (int)(aMonths[anIndex]), + (int)(aYears[anIndex]), + aNames[anIndex].c_str()); a = strlen(aProperty); aProperty[a++] = 1; } @@ -471,8 +439,8 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_St * Purpose : save the study in HDF file */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, - const Handle(SALOMEDSImpl_Study)& aStudy, +bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl, + SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile, bool theASCII) @@ -480,7 +448,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, // 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 + // * Study Structure -> Exactly what is contained in Document // Informations in data group hdf_group_study_structure _errorCode = ""; @@ -496,34 +464,33 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, hdf_int32 name_len = 0; char *component_name = 0; + if(!aStudy) { + _errorCode = "Study is null"; + return false; + } + int aLocked = aStudy->GetProperties()->IsLocked(); if (aLocked) aStudy->GetProperties()->SetLocked(false); - Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder(); + SALOMEDSImpl_StudyBuilder* SB= aStudy->NewBuilder(); map 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(); - + SALOMEDSImpl_SComponent sco = itcomponent1.Value(); // if there is an associated Engine call its method for saving - TCollection_AsciiString IOREngine; + string IOREngine; try { - if (!sco->ComponentIOR(IOREngine)) { - TCollection_AsciiString aCompType = sco->GetComment(); - if (!aCompType.IsEmpty()) { + if (!sco.ComponentIOR(IOREngine)) { + string aCompType = sco.GetComment(); + if (!aCompType.empty()) { SALOMEDSImpl_Driver* aDriver = aFactory->GetDriverByType(aCompType); - aMapTypeDriver[aCompType.ToCString()] = aDriver; + aMapTypeDriver[aCompType] = aDriver; if (aDriver != NULL) { if(!SB->LoadWith(sco, aDriver)) { @@ -539,12 +506,12 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, } } - TCollection_AsciiString anOldName = aStudy->Name(); + string 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 = new HDFfile((char*)aUrl.c_str()); hdf_file->CreateOnDisk(); //----------------------------------------------------------------------- @@ -557,20 +524,20 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, for (; itcomponent.More(); itcomponent.Next()) { - Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value(); + SALOMEDSImpl_SComponent sco = itcomponent.Value(); - TCollection_AsciiString scoid = sco->GetID(); - hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group_datacomponent); + string scoid = sco.GetID(); + hdf_sco_group = new HDFgroup((char*)scoid.c_str(), hdf_group_datacomponent); hdf_sco_group->CreateOnDisk(); - TCollection_AsciiString componentDataType = sco->ComponentDataType(); - TCollection_AsciiString IOREngine; - if (sco->ComponentIOR(IOREngine)) + string componentDataType = sco.ComponentDataType(); + string IOREngine; + if (sco.ComponentIOR(IOREngine)) { SALOMEDSImpl_Driver* Engine = NULL; - if(aMapTypeDriver.find(componentDataType.ToCString()) != aMapTypeDriver.end()) { + if(aMapTypeDriver.find(componentDataType) != aMapTypeDriver.end()) { // we have found the associated engine to write the data - Engine = aMapTypeDriver[componentDataType.ToCString()]; + Engine = aMapTypeDriver[componentDataType]; } else { Engine = aFactory->GetDriverByIOR(IOREngine); @@ -578,8 +545,8 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, if (Engine != NULL) { - Handle(SALOMEDSImpl_TMPFile) aStream; - long length; + SALOMEDSImpl_TMPFile* aStream = NULL; + long length = 0; if (theASCII) aStream = Engine->SaveASCII(sco, SALOMEDSImpl_Tool::GetDirFromPath(aUrl), @@ -601,6 +568,8 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, hdf_dataset->CloseOnDisk(); } + if(aStream) delete aStream; + // store multifile state aHDFSize[0] = 2; hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1); @@ -634,13 +603,13 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, 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); + SALOMEDSImpl_SComponent SC = itcomp.Value(); + string scid = SC.GetID(); + hdf_sco_group2 = new HDFgroup((char*)scid.c_str(), hdf_group_study_structure); hdf_sco_group2->CreateOnDisk(); SaveAttributes(SC, hdf_sco_group2); // ComponentDataType treatment - component_name = SC->ComponentDataType().ToCString(); + component_name = (char*)SC.ComponentDataType().c_str(); name_len = (hdf_int32)strlen(component_name); size[0] = name_len +1 ; hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1); @@ -652,12 +621,11 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, 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()) { + SALOMEDSImpl_SObject aSO = aStudy->FindObjectID(USE_CASE_LABEL_ID); + if (aSO) { HDFgroup *hdf_soo_group = new HDFgroup(USE_CASE_LABEL_ID,hdf_group_study_structure); hdf_soo_group->CreateOnDisk(); SaveAttributes(aSO, hdf_soo_group); @@ -670,17 +638,16 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, //----------------------------------------------------------------------- //5 - Write the Study Properties //----------------------------------------------------------------------- - name_len = (hdf_int32) aStudy->Name().Length(); + name_len = (hdf_int32) aStudy->Name().size(); 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(); + char* studid = (char*)aStudy->Name().c_str(); 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(); @@ -704,7 +671,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, return false; } if (theASCII) { // save file in ASCII format - HDFascii::ConvertFromHDFToASCII(aUrl.ToCString(), true); + HDFascii::ConvertFromHDFToASCII(aUrl.c_str(), true); } return true; @@ -715,7 +682,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC, +bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype) { _errorCode = ""; @@ -725,29 +692,32 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObjec HDFgroup *hdf_group_sobject = 0; - TDF_ChildIterator itchild(SC->GetLabel()); + DF_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()); + vector attr = itchild.Value().GetAttributes(); + if (attr.size() == 0) { //No attributes on the label + DF_ChildIterator subchild(itchild.Value()); if (!subchild.More()) { continue; } - subchild.Initialize(SC->GetLabel(), true); + subchild.Init(itchild.Value(), 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 + vector attr2 = subchild.Value().GetAttributes(); + if (attr2.size()) { + anEmpty = false; //There are attributes on the child label + break; + } } if (anEmpty) continue; } - Handle(SALOMEDSImpl_SObject) SO = SALOMEDSImpl_Study::SObject(itchild.Value()); + SALOMEDSImpl_SObject SO = SALOMEDSImpl_Study::SObject(itchild.Value()); - char* scoid = (char*) SO->GetID().ToCString(); + char* scoid = (char*) SO.GetID().c_str(); hdf_group_sobject = new HDFgroup(scoid, hdf_group_datatype); hdf_group_sobject->CreateOnDisk(); SaveAttributes(SO, hdf_group_sobject); @@ -764,14 +734,13 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObjec * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_StudyManager::Impl_SubstituteSlash(const TCollection_AsciiString& aUrl) +string SALOMEDSImpl_StudyManager::Impl_SubstituteSlash(const string& aUrl) { _errorCode = ""; - TCollection_ExtendedString theUrl(aUrl); - Standard_ExtCharacter val1 = ToExtCharacter('/'); - Standard_ExtCharacter val2 = ToExtCharacter(':'); - theUrl.ChangeAll(val1,val2); + std::string theUrl(aUrl); + for(int i = 0; i_doc; @@ -791,15 +760,15 @@ Handle(TDocStd_Document) SALOMEDSImpl_StudyManager::GetDocumentOfStudy(const Han * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject, +bool SALOMEDSImpl_StudyManager::CanCopy(const 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; + SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent(); + if (!aComponent) return false; + if (aComponent.GetLabel() == theObject.GetLabel()) return false; + string IOREngine; + if (!aComponent.ComponentIOR(IOREngine)) return false; if (theEngine == NULL) return false; return theEngine->CanCopy(theObject); } @@ -809,63 +778,64 @@ bool SALOMEDSImpl_StudyManager::CanCopy(const Handle(SALOMEDSImpl_SObject)& theO * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy, +bool SALOMEDSImpl_StudyManager::CopyLabel(SALOMEDSImpl_Study* theSourceStudy, SALOMEDSImpl_Driver* theEngine, - const Standard_Integer theSourceStartDepth, - const TDF_Label& theSource, - const TDF_Label& theDestinationMain) + const int theSourceStartDepth, + const DF_Label& theSource, + const DF_Label& theDestinationMain) { _errorCode = ""; int a; - TDF_Label aTargetLabel = theDestinationMain; - TDF_Label aAuxTargetLabel = theDestinationMain.Father().FindChild(2); + DF_Label aTargetLabel = theDestinationMain; + DF_Label aAuxTargetLabel = theDestinationMain.Father().FindChild(2); for(a = theSource.Depth() - theSourceStartDepth; a > 0 ; a--) { - TDF_Label aSourceLabel = theSource; + DF_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); + vector attrList = theSource.GetAttributes(); + for(int i = 0, len = attrList.size(); i(anAttr)->Get(); + string anEntry = aReferenced.Entry(); // store the value of name attribute of referenced label - Handle(SALOMEDSImpl_AttributeName) aNameAttribute; - if (aReferenced.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttribute)) { + SALOMEDSImpl_AttributeName* aNameAttribute; + if ((aNameAttribute=(SALOMEDSImpl_AttributeName*)aReferenced.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { anEntry += " "; anEntry += aNameAttribute->Value(); } - SALOMEDSImpl_AttributeComment::Set(aAuxTargetLabel, TCollection_ExtendedString(anEntry)); + SALOMEDSImpl_AttributeComment::Set(aAuxTargetLabel, 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()); + if (type == string("AttributeIOR")) { // IOR => ID and TMPFile of Engine + string anEntry = theSource.Entry(); + SALOMEDSImpl_SObject aSO = theSourceStudy->FindObjectID(anEntry); int anObjID; long aLen; - Handle(SALOMEDSImpl_TMPFile) aStream = theEngine->CopyFrom(aSO, anObjID, aLen); - TCollection_ExtendedString aResStr(""); + SALOMEDSImpl_TMPFile* aStream = theEngine->CopyFrom(aSO, anObjID, aLen); + string aResStr(""); for(a = 0; a < aLen; a++) { - aResStr += TCollection_ExtendedString(ToExtCharacter(Standard_Character(aStream->Get(a)))); + aResStr += (char)(aStream->Get(a)); } + + if(aStream) delete aStream; + SALOMEDSImpl_AttributeInteger::Set(aAuxTargetLabel, anObjID); SALOMEDSImpl_AttributeName::Set(aAuxTargetLabel, aResStr); continue; } - Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty(); + DF_Attribute* aNewAttribute = anAttr->NewEmpty(); aTargetLabel.AddAttribute(aNewAttribute); - anAttr->Paste(aNewAttribute, aRT); + anAttr->Paste(aNewAttribute); } return true; @@ -876,48 +846,46 @@ bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theS * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObject, +bool SALOMEDSImpl_StudyManager::Copy(const 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()); + aStructureOnly = !theObject.GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID()); // get component-engine - Handle(SALOMEDSImpl_Study) aStudy = theObject->GetStudy(); + 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"; + DF_Document* aDocument = GetDocumentOfStudy(aStudy); + if (!aDocument) { + _errorCode = "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; + _clipboard->Main().Root().ForgetAllAttributes(true); + _appli->Close(_clipboard); + _clipboard = _appli->NewDocument("SALOME_STUDY"); // set component data type to the name attribute of root label if (!aStructureOnly) { SALOMEDSImpl_AttributeComment::Set(_clipboard->Main().Root(), - TCollection_ExtendedString(theEngine->ComponentDataType())); + 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(); + DF_Label aStartLabel = theObject.GetLabel(); + int 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); + DF_ChildIterator anIterator(aStartLabel, true); for(; anIterator.More(); anIterator.Next()) { CopyLabel(aStudy, theEngine, aSourceStartDepth, anIterator.Value(), _clipboard->Main()); } @@ -929,34 +897,34 @@ bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObje * Purpose : */ //============================================================================ -bool SALOMEDSImpl_StudyManager::CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject, +bool SALOMEDSImpl_StudyManager::CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* theEngine) { _errorCode = ""; - if (_clipboard.IsNull()) { + if (!_clipboard) { _errorCode = "Clipboard is null"; return false; } - Handle(SALOMEDSImpl_AttributeComment) aCompName; - if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aCompName)) { + SALOMEDSImpl_AttributeComment* aCompName = NULL; + if (!(aCompName=(SALOMEDSImpl_AttributeComment*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) { _errorCode = "Clipboard has no component type"; return false; } - Handle(SALOMEDSImpl_AttributeInteger) anObjID; - if (!_clipboard->Main().Father().FindChild(2).FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anObjID)) { + SALOMEDSImpl_AttributeInteger* anObjID; + if (!(anObjID=(SALOMEDSImpl_AttributeInteger*)_clipboard->Main().Father().FindChild(2).FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) { _errorCode = "Clipboard has no object id"; return false; } - Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent(); - if (aComponent.IsNull()) { + SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent(); + if (!aComponent) { _errorCode = "Object doesn't belong to component"; return false; } - TCollection_AsciiString IOREngine; - if (!aComponent->ComponentIOR(IOREngine)) { + string IOREngine; + if (!aComponent.ComponentIOR(IOREngine)) { _errorCode = "component has no IOR"; return false; } @@ -968,23 +936,23 @@ bool SALOMEDSImpl_StudyManager::CanPaste(const Handle(SALOMEDSImpl_SObject)& the * 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) +DF_Label SALOMEDSImpl_StudyManager::PasteLabel(SALOMEDSImpl_Study* theDestinationStudy, + SALOMEDSImpl_Driver* theEngine, + const DF_Label& theSource, + const DF_Label& theDestinationStart, + const int theCopiedStudyID, + const bool isFirstElement) { _errorCode = ""; // get corresponding source, target and auxiliary labels - TDF_Label aTargetLabel = theDestinationStart; + DF_Label aTargetLabel = theDestinationStart; - TDF_Label aAuxSourceLabel = theSource.Root().FindChild(2); + DF_Label aAuxSourceLabel = theSource.Root().FindChild(2); int a; if (!isFirstElement) { for(a = theSource.Depth() - 1; a > 0 ; a--) { - TDF_Label aSourceLabel = theSource; + DF_Label aSourceLabel = theSource; for(int aNbFather = 1; aNbFather < a; aNbFather++) aSourceLabel = aSourceLabel.Father(); aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag()); aAuxSourceLabel = aAuxSourceLabel.FindChild(aSourceLabel.Tag()); @@ -992,36 +960,32 @@ TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study) } // 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(); + SALOMEDSImpl_AttributeName* aNameAttribute = NULL; + if ((aNameAttribute=(SALOMEDSImpl_AttributeName*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { + SALOMEDSImpl_AttributeInteger* anObjID = (SALOMEDSImpl_AttributeInteger*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()); + SALOMEDSImpl_AttributeComment* aComponentName = (SALOMEDSImpl_AttributeComment*)theSource.Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID()); + string aCompName = aComponentName->Value(); if (theEngine->CanPaste(aCompName, anObjID->Value())) { - TCollection_ExtendedString aTMPStr = aNameAttribute->Value(); - int aLen = aTMPStr.Length(); + std::string aTMPStr = aNameAttribute->Value(); + int aLen = aTMPStr.size(); 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)); + aStream[a] = aTMPStr[a]; } } - TCollection_AsciiString anEntry; - TDF_Tool::Entry(aTargetLabel, anEntry); - Handle(SALOMEDSImpl_SObject) aPastedSO = theDestinationStudy->FindObjectID(anEntry); + string anEntry = aTargetLabel.Entry(); + 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); + string aDestEntry = theEngine->PasteInto(aStream, + aLen, + anObjID->Value(), + aPastedSO.GetFatherComponent()); + aTargetLabel = DF_Label::Label(theDestinationStart, aDestEntry); } else theEngine->PasteInto(aStream, aLen, anObjID->Value(), aPastedSO); @@ -1030,38 +994,35 @@ TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study) } // 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)) { + vector attrList = theSource.GetAttributes(); + for(int i = 0, len = attrList.size(); iID())) { aTargetLabel.ForgetAttribute(anAttr->ID()); - anAttr = anAttrIterator.Value(); } - Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty(); + DF_Attribute* aNewAttribute = anAttr->NewEmpty(); aTargetLabel.AddAttribute(aNewAttribute); - anAttr->Paste(aNewAttribute, aRT); + anAttr->Paste(aNewAttribute); } // 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()); + SALOMEDSImpl_AttributeComment* aCommentAttribute = NULL; + if ((aCommentAttribute=(SALOMEDSImpl_AttributeComment*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) { + char * anEntry = new char[aCommentAttribute->Value().size() + 1]; + strcpy(anEntry, string(aCommentAttribute->Value()).c_str()); 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); + DF_Label aRefLabel = DF_Label::Label(aTargetLabel, anEntry); 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); + else SALOMEDSImpl_AttributeName::Set(aTargetLabel, std::string("Reference to:")+anEntry); } delete [] anEntry; } @@ -1074,12 +1035,13 @@ TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study) * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOMEDSImpl_SObject)& theObject, - SALOMEDSImpl_Driver* theEngine) +SALOMEDSImpl_SObject SALOMEDSImpl_StudyManager::Paste(const SALOMEDSImpl_SObject& theObject, + SALOMEDSImpl_Driver* theEngine) { _errorCode = ""; - Handle(SALOMEDSImpl_Study) aStudy = theObject->GetStudy(); + SALOMEDSImpl_SObject so; + SALOMEDSImpl_Study* aStudy = theObject.GetStudy(); // if study is locked, then paste can't be done if (aStudy->GetProperties()->IsLocked()) { @@ -1088,40 +1050,38 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOM } // 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); + SALOMEDSImpl_AttributeComment* aComponentName = NULL; + bool aStructureOnly = !(aComponentName=(SALOMEDSImpl_AttributeComment*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID())); // get copied study ID - Handle(SALOMEDSImpl_AttributeInteger) aStudyIDAttribute; - if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), aStudyIDAttribute)) { + SALOMEDSImpl_AttributeInteger* aStudyIDAttribute = NULL; + if (!(aStudyIDAttribute=(SALOMEDSImpl_AttributeInteger*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) { _errorCode = "No study ID was found"; - return NULL; + return so; } 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; + DF_Document* aDocument = GetDocumentOfStudy(aStudy); + if (!aDocument) { + _errorCode = "Document is null"; + return so; } - Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent(); + SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent(); // fill root inserted SObject - TDF_Label aStartLabel; + DF_Label aStartLabel; if (aStructureOnly) { - TDF_Label anObjectLabel; - TDF_Tool::Label(aDocument->GetData(), theObject->GetID(), anObjectLabel); + DF_Label anObjectLabel = DF_Label::Label(aDocument->Main(), theObject.GetID()); aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), anObjectLabel, aCStudyID, false); } else { - TDF_Label aComponentLabel; - TDF_Tool::Label(aDocument->GetData(), aComponent->GetID(), aComponentLabel); + DF_Label aComponentLabel = DF_Label::Label(aDocument->Main(), aComponent.GetID()); aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), aComponentLabel, aCStudyID, true); } // paste all sublebels - TDF_ChildIterator anIterator(_clipboard->Main(), Standard_True); + DF_ChildIterator anIterator(_clipboard->Main(), true); for(; anIterator.More(); anIterator.Next()) { PasteLabel(aStudy, theEngine, anIterator.Value(), aStartLabel, aCStudyID, false); } @@ -1138,22 +1098,22 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOM * Purpose : Save attributes for object */ //============================================================================ -static void SaveAttributes(Handle(SALOMEDSImpl_SObject) aSO, HDFgroup *hdf_group_sobject) +static void SaveAttributes(const 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(); + vector attrList = aSO.GetLabel().GetAttributes(); + DF_Attribute* anAttr = NULL; + for(int i = 0, len = attrList.size(); iDynamicType() == 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); + string type = SALOMEDSImpl_GenericAttribute::Impl_GetType(anAttr); + if(type == string("AttributeIOR")) continue; //IOR attribute is not saved + string aSaveStr =anAttr->Save(); + //cout << "Saving: " << aSO.GetID() << " type: "<< type<<"|" << endl; + size[0] = (hdf_int32) strlen(aSaveStr.c_str()) + 1; + HDFdataset *hdf_dataset = new HDFdataset((char*)type.c_str(), hdf_group_sobject, HDF_STRING,size, 1); hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk((char*)aSaveStr.ToCString()); + hdf_dataset->WriteOnDisk((char*)aSaveStr.c_str()); hdf_dataset->CloseOnDisk(); hdf_dataset=0; //will be deleted by hdf_sco_group destructor } @@ -1162,17 +1122,16 @@ static void SaveAttributes(Handle(SALOMEDSImpl_SObject) aSO, HDFgroup *hdf_group //=========================================================================== //Function : ReadAttributes //=========================================================================== -static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy, - const Handle(SALOMEDSImpl_SObject)& aSO, +static void ReadAttributes(SALOMEDSImpl_Study* theStudy, + const SALOMEDSImpl_SObject& aSO, HDFdataset* hdf_dataset) { hdf_dataset->OpenOnDisk(); - Handle(TDF_Attribute) anAttr; - + DF_Attribute* anAttr = NULL; char* current_string = new char[hdf_dataset->GetSize()+1]; hdf_dataset->ReadFromDisk(current_string); - + //cout << "Reading attr type = " << hdf_dataset->GetName() << " SO = " << aSO.GetID() << endl; if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) { anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, "AttributeComment"); } else if (!strcmp(hdf_dataset->GetName(),"AttributeReference") || @@ -1185,11 +1144,8 @@ static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy, 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; + if (anAttr) { + anAttr->Load(current_string); } delete(current_string); @@ -1199,10 +1155,10 @@ static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy, //============================================================================ //Function : BuildlTree //============================================================================ -static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf_current_group) +static void BuildTree (SALOMEDSImpl_Study* theStudy, HDFgroup* hdf_current_group) { hdf_current_group->OpenOnDisk(); - Handle(SALOMEDSImpl_SObject) aSO; + SALOMEDSImpl_SObject aSO; char* Entry = hdf_current_group->GetName(); if (strcmp(Entry,"STUDY_STRUCTURE") == 0) { aSO = theStudy->CreateObjectID("0:1"); @@ -1212,8 +1168,8 @@ static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf } char name[HDF_NAME_MAX_LEN+1]; - Standard_Integer nbsons = hdf_current_group->nInternalObjects(); - for (Standard_Integer i=0; inInternalObjects(); + for (int i=0; iInternalObjectIndentify(i,name); if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue; hdf_object_type type = hdf_current_group->InternalObjectType(name); @@ -1237,23 +1193,24 @@ static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf //============================================================================ //Function : Translate_IOR_to_persistentID //============================================================================ -static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)& so, +static void Translate_IOR_to_persistentID (const SALOMEDSImpl_SObject& so, SALOMEDSImpl_Driver* engine, bool isMultiFile, bool isASCII) { - TDF_ChildIterator itchild(so->GetLabel()); - TCollection_AsciiString ior_string, persistent_string, curid; + DF_ChildIterator itchild(so.GetLabel()); + string 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)) { + SALOMEDSImpl_SObject current = SALOMEDSImpl_Study::SObject(itchild.Value()); + SALOMEDSImpl_AttributeIOR* IOR = NULL; + if ((IOR=(SALOMEDSImpl_AttributeIOR*)current.GetLabel().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { ior_string = IOR->Value(); persistent_string = engine->IORToLocalPersistentID (current, ior_string, isMultiFile, isASCII); - SALOMEDSImpl_AttributePersistentRef::Set(current->GetLabel(), persistent_string); + SALOMEDSImpl_AttributePersistentRef::Set(current.GetLabel(), persistent_string); } Translate_IOR_to_persistentID (current, engine, isMultiFile, isASCII); } } + diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx index 2009b0dfb..190317bbc 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx @@ -24,36 +24,30 @@ #ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__ #define __SALOMEDSImpl_STUDYMANAGER_I_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared ) - // std C++ headers #include +#include +#include -// Cascade headers -#include "SALOMEDSImpl_OCAFApplication.hxx" +#include "DF_Application.hxx" #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_Driver.hxx" -#include -#include -#include -#include -#include +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include "DF_Document.hxx" class HDFgroup; -class SALOMEDSImpl_StudyManager : public MMgt_TShared +class SALOMEDSImpl_StudyManager { private: - Handle (SALOMEDSImpl_OCAFApplication) _OCAFApp; - int _IDcounter; - Handle(TDocStd_Document) _clipboard; - TCollection_AsciiString _errorCode; + DF_Application* _appli; + int _IDcounter; + DF_Document* _clipboard; + std::string _errorCode; public: @@ -64,85 +58,82 @@ public: 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); + Standard_EXPORT virtual SALOMEDSImpl_Study* NewStudy(const std::string& study_name); //! method to Open a Study from it's persistent reference - Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) Open(const TCollection_AsciiString& aStudyUrl); + Standard_EXPORT virtual SALOMEDSImpl_Study* Open(const std::string& aStudyUrl); //! method to close a Study - Standard_EXPORT virtual void Close(const Handle(SALOMEDSImpl_Study)& aStudy); + Standard_EXPORT virtual void Close(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 Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile); - Standard_EXPORT virtual bool SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy, - SALOMEDSImpl_DriverFactory* aFactory, - bool theMultiFile); + Standard_EXPORT virtual bool SaveASCII(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 SaveAs(const std::string& aUrl, + 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); + Standard_EXPORT virtual bool SaveAsASCII(const std::string& aUrl, + 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(); + Standard_EXPORT virtual std::vector GetOpenStudies(); //! method to get a Study from it's name - Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByName(const TCollection_AsciiString& aStudyName) ; + Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByName(const std::string& aStudyName) ; //! method to get a Study from it's ID - Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByID(int aStudyID) ; + Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByID(int aStudyID) ; - Standard_EXPORT Handle(TDocStd_Document) GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy); + Standard_EXPORT DF_Document* GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy); - Standard_EXPORT Handle(TDocStd_Document) GetClipboard() { return _clipboard; } + Standard_EXPORT DF_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 bool CopyLabel(SALOMEDSImpl_Study* theSourceStudy, + SALOMEDSImpl_Driver* theEngine, + const int theSourceStartDepth, + const DF_Label& theSource, + const DF_Label& theDestinationMain); + + Standard_EXPORT DF_Label PasteLabel(SALOMEDSImpl_Study* theDestinationStudy, + SALOMEDSImpl_Driver* theEngine, + const DF_Label& theSource, + const DF_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); + Standard_EXPORT virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine); + Standard_EXPORT virtual bool Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine); + Standard_EXPORT virtual bool CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine); + Standard_EXPORT virtual SALOMEDSImpl_SObject Paste(const 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); + Standard_EXPORT virtual bool Impl_SaveAs(const std::string& aUrl, + 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); + Standard_EXPORT virtual bool Impl_SaveObject(const 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 std::string Impl_SubstituteSlash(const std::string& aUrl); - Standard_EXPORT virtual bool Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, HDFgroup *hdf_group); + Standard_EXPORT virtual bool Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group); - Standard_EXPORT TCollection_AsciiString GetErrorCode() { return _errorCode; } + Standard_EXPORT std::string GetErrorCode() { return _errorCode; } Standard_EXPORT virtual bool IsError() { return _errorCode != ""; } -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyManager ) - }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx index 7b0c2e2f3..04a20312a 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx @@ -25,13 +25,6 @@ #include "SALOMEDSImpl_TMPFile.hxx" -#include -#include - - -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_TMPFile, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_TMPFile, MMgt_TShared ) - SALOMEDSImpl_TMPFile::TOctet* SALOMEDSImpl_TMPFile ::Data() diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx index 651673e9c..3d63b66cd 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx @@ -21,26 +21,19 @@ #ifndef __SALOMEDSIMPL_TMPFILE_H__ #define __SALOMEDSIMPL_TMPFILE_H__ -//Handle definition -#include -#include -#include +#include "DF_definitions.hxx" -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_TMPFile, MMgt_TShared ); - - -struct SALOMEDSImpl_TMPFile : public MMgt_TShared +struct SALOMEDSImpl_TMPFile { typedef unsigned char TOctet; + //typedef unsigned int size_t; Standard_EXPORT virtual size_t Size() = 0; Standard_EXPORT virtual TOctet* Data(); Standard_EXPORT virtual TOctet& Get(size_t) = 0; - - DEFINE_STANDARD_RTTI( SALOMEDSImpl_TMPFile ); }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx index 4755e3c07..7d817c961 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx @@ -29,111 +29,135 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include + #ifndef WNT #include +#include +#include +#include +#include #else #include +#include #endif + #include using namespace std; + +bool Exists(const string thePath) +{ +#ifdef WNT + if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { + if ( GetLastError () != ERROR_FILE_NOT_FOUND ) { + return false; + } + } +#else + int status = access ( thePath.c_str() , F_OK ); + if (status != 0) return false; +#endif + return true; +} + + + + //============================================================================ // function : GetTempDir // purpose : Return a temp directory to store created files like "/tmp/sub_dir/" //============================================================================ -TCollection_AsciiString SALOMEDSImpl_Tool::GetTmpDir() +string SALOMEDSImpl_Tool::GetTmpDir() { //Find a temporary directory to store a file - TCollection_AsciiString aTmpDir; + string aTmpDir; char *Tmp_dir = getenv("SALOME_TMP_DIR"); if(Tmp_dir != NULL) { - aTmpDir = TCollection_AsciiString(Tmp_dir); + aTmpDir = string(Tmp_dir); #ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; + if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; #else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; + if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; #endif } else { #ifdef WIN32 - aTmpDir = TCollection_AsciiString("C:\\"); + aTmpDir = string("C:\\"); #else - aTmpDir = TCollection_AsciiString("/tmp/"); + aTmpDir = string("/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"); + char buffer[127]; + sprintf(buffer, "%d", aRND); + string aSubDir(buffer); + if(aSubDir.size() <= 1) aSubDir = string("123409876"); aTmpDir += aSubDir; //Get RND sub directory + string aDir = aTmpDir; + + if(Exists(aDir)) { + for(aRND = 0; Exists(aDir); aRND++) { + sprintf(buffer, "%d", aRND); + aDir = aTmpDir+buffer; //Build a unique directory name + } + } + #ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; + if(aDir[aTmpDir.size()-1] != '\\') aDir+='\\'; #else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; + if(aDir[aTmpDir.size()-1] != '/') aDir+='/'; #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); +#ifdef WNT + CreateDirectory(aDir.c_str(), NULL); +#else + mkdir(aDir.c_str(), 0x1ff); +#endif - return aTmpDir; + return aDir; } //============================================================================ // function : RemoveTemporaryFiles // purpose : Removes files listed in theFileList //============================================================================ -void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const TCollection_AsciiString& theDirectory, - const Handle(TColStd_HSequenceOfAsciiString)& theFiles, +void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const string& theDirectory, + const vector& theFiles, const bool IsDirDeleted) { - TCollection_AsciiString aDirName = theDirectory; + string aDirName = theDirectory; - int i, aLength = theFiles->Length(); + int i, aLength = theFiles.size(); 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(); + string aFile(aDirName); + aFile += theFiles[i-1]; + if(!Exists(aFile)) continue; + +#ifdef WNT + DeleteFile(aFile.c_str()); +#else + unlink(aFile.c_str()); +#endif } if(IsDirDeleted) { - OSD_Path aPath(aDirName); - OSD_Directory aDir(aPath); - OSD_FileIterator anIterator(aPath, '*'); - - if(aDir.Exists() && !anIterator.More()) aDir.Remove(); + if(Exists(aDirName)) { +#ifdef WNT + RemoveDirectory(aDireName.c_str()); +#else + rmdir(aDirName.c_str()); +#endif + } } } @@ -142,34 +166,125 @@ void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const TCollection_AsciiString& theD // 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; +string SALOMEDSImpl_Tool::GetNameFromPath(const string& thePath) { + if (thePath.empty()) return ""; + int pos = thePath.rfind('/'); + if(pos > 0) return thePath.substr(pos+1, thePath.size()); + pos = thePath.rfind('\\'); + if(pos > 0) return thePath.substr(pos+1, thePath.size()); + pos = thePath.rfind('|'); + if(pos > 0) return thePath.substr(pos+1, thePath.size()); + return thePath; } //============================================================================ // 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; - /*Unix platform don't use assignment in string - but we must to add it for WNT case*/ - TCollection_AsciiString disk = aPath.Disk(); - if(disk.Length()) aDirString.AssignCat(disk); - aDirString.AssignCat(aPath.Trek()); - aDirString.ChangeAll('|','/'); - return aDirString; +string SALOMEDSImpl_Tool::GetDirFromPath(const string& thePath) { + if (thePath.empty()) return ""; + + int pos = thePath.rfind('/'); + string path; + if(pos > 0) { + path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('\\'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('|'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + path = thePath+"/"; + } + +#ifdef WNT //Check if the only disk letter is given as path + if(path.size() == 2 && path[1] == ":") path +='\\'; +#endif + + for(int i = 0, len = path.size(); i SALOMEDSImpl_Tool::splitString(const string& theValue, char separator) +{ + vector vs; + if(theValue[0] == separator && theValue.size() == 1) return vs; + int pos = theValue.find(separator); + if(pos < 0) { + vs.push_back(theValue); + return vs; + } + + string s = theValue; + if(s[0] == separator) s = s.substr(1, s.size()); + while((pos = s.find(separator)) >= 0) { + vs.push_back(s.substr(0, pos)); + s = s.substr(pos+1, s.size()); + } + + if(!s.empty() && s[0] != separator) vs.push_back(s); + return vs; } +void SALOMEDSImpl_Tool::GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds) +{ +#ifdef WNT + SYSTEMTIME st; + GetLocalTime ( &st ); + month = st.wMonth; + day = st.wDay; + year = st.wYear; + hours = st.wHour; + minutes = st.wMinute; + seconds = st.wSecond; +#else + struct tm transfert; + struct timeval tval; + struct timezone tzone; + int status; + + status = gettimeofday( &tval, &tzone ); + memcpy(&transfert, localtime((time_t *)&tval.tv_sec), sizeof(tm)); + + month = transfert.tm_mon + 1; + day = transfert.tm_mday; + year = transfert.tm_year + 1900; + hours = transfert.tm_hour; + minutes = transfert.tm_min ; + seconds = transfert.tm_sec ; +#endif +} +string SALOMEDSImpl_Tool::GetUserName() +{ +#ifdef WNT + char* pBuff = new char[UNLEN + 1]; + DWORD dwSize = UNLEN + 1; + string retVal; + GetUserName ( pBuff, &dwSize ); + string theTmpUserName(pBuff,(int)dwSize -1 ); + retVal = theTmpUserName; + delete [] pBuff; + return retVal; +#else + struct passwd *infos; + infos = getpwuid(getuid()); + return string(infos->pw_name); +#endif +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx index 37131a277..36ca6874f 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx @@ -28,9 +28,9 @@ #ifndef __SALOMEDSIMPL_TOOL_H__ #define __SALOMEDSIMPL_TOOL_H__ -#include -#include -#include +#include +#include +#include "DF_Label.hxx" class SALOMEDSImpl_Tool { @@ -39,22 +39,31 @@ 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(); + static std::string GetTmpDir(); // Removes files which are in , the files for deletion are listed in // if is true is also deleted if it is empty - static void RemoveTemporaryFiles(const TCollection_AsciiString& theDirectory, - const Handle(TColStd_HSequenceOfAsciiString)& theFiles, + static void RemoveTemporaryFiles(const std::string& theDirectory, + const std::vector& 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); + 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 TCollection_AsciiString GetDirFromPath(const TCollection_AsciiString& thePath); + static std::string GetDirFromPath(const std::string& thePath); + + //The functions returns a list of substring of initial string divided by given separator + static std::vector splitString(const std::string& theValue, char separator); + + //Returns a system date + static void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds); + + //Returns a name of the user + static std::string GetUserName(); }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx index 3f6f339ce..a28228981 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx @@ -28,20 +28,10 @@ #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_Attributes.hxx" -#include -#include -#include -#include -#include -#include -#include +#include "DF_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" @@ -51,24 +41,23 @@ IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared ) * Purpose : */ //============================================================================ -SALOMEDSImpl_UseCaseBuilder::SALOMEDSImpl_UseCaseBuilder(const Handle(TDocStd_Document)& theDocument) +SALOMEDSImpl_UseCaseBuilder::SALOMEDSImpl_UseCaseBuilder(DF_Document* theDocument) :_doc(theDocument) { - if(_doc.IsNull()) return; + if(!_doc) 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)); + DF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases + if(!(_root = (SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(std::string(USE_CASE_GUID)))) { + _root = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, std::string(USE_CASE_GUID)); } - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + SALOMEDSImpl_AttributeReference* aRef = NULL; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { 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"); + if(!aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID())) { + SALOMEDSImpl_AttributeName::Set(aLabel, "Use cases"); } } @@ -87,24 +76,25 @@ SALOMEDSImpl_UseCaseBuilder::~SALOMEDSImpl_UseCaseBuilder() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::Append(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::Append(const SALOMEDSImpl_SObject& theObject) { - if(_root.IsNull() || theObject.IsNull()) return false; + if(!_root || !theObject) return false; - TDF_Label aLabel = theObject->GetLabel(); + DF_Label aLabel = theObject.GetLabel(); if(aLabel.IsNull()) return false; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aCurrentNode; + SALOMEDSImpl_AttributeTreeNode* aNode = NULL; + SALOMEDSImpl_AttributeTreeNode* aCurrentNode = NULL; aNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, _root->ID()); aNode->Remove(); - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + SALOMEDSImpl_AttributeReference* aRef; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label()); } - TDF_Label aCurrent = aRef->Get(); - if(aCurrent.IsNull() || !aCurrent.FindAttribute(_root->ID(), aCurrentNode)) + DF_Label aCurrent = aRef->Get(); + if(aCurrent.IsNull() || !(aCurrentNode=(SALOMEDSImpl_AttributeTreeNode*)aCurrent.FindAttribute(_root->ID()))) aCurrentNode = _root; aCurrentNode->Append(aNode); @@ -117,37 +107,37 @@ bool SALOMEDSImpl_UseCaseBuilder::Append(const Handle(SALOMEDSImpl_SObject)& the * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::Remove(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::Remove(const SALOMEDSImpl_SObject& theObject) { - if(_root.IsNull() || theObject.IsNull()) return false; + if(!_root || !theObject) return false; - TDF_Label aLabel = theObject->GetLabel(); + DF_Label aLabel = theObject.GetLabel(); if(aLabel.IsNull()) return false; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return false; + SALOMEDSImpl_AttributeTreeNode* aNode = NULL; + if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false; aNode->Remove(); - TDF_AttributeList aList; - aList.Append(aNode); + vector aList; + aList.push_back(aNode); - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + SALOMEDSImpl_AttributeReference* aRef = NULL; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label()); } - TDF_Label aCurrent = aRef->Get(); - SALOMEDSImpl_ChildNodeIterator aChildItr(aNode, Standard_True); + DF_Label aCurrent = aRef->Get(); + + SALOMEDSImpl_ChildNodeIterator aChildItr(aNode, true); for(; aChildItr.More(); aChildItr.Next()) - aList.Append(aChildItr.Value()); + aList.push_back(aChildItr.Value()); - TDF_ListIteratorOfAttributeList anIterator(aList); - for(; anIterator.More(); anIterator.Next()) { - if(anIterator.Value()->Label() == aCurrent) { //The current node is removed + for(int i = 0, len = aList.size(); iLabel() == aCurrent) { //The current node is removed aRef->Set(_root->Label()); //Reset the current node to the root } - anIterator.Value()->Label().ForgetAttribute(_root->ID()); + aList[i]->Label().ForgetAttribute(_root->ID()); } return true; @@ -159,21 +149,21 @@ bool SALOMEDSImpl_UseCaseBuilder::Remove(const Handle(SALOMEDSImpl_SObject)& the * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const Handle(SALOMEDSImpl_SObject)& theFather, - const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const SALOMEDSImpl_SObject& theFather, + const SALOMEDSImpl_SObject& theObject) { - if(_root.IsNull() || theFather.IsNull() || theObject.IsNull()) return false; + if(!_root || !theFather || !theObject) return false; - TDF_Label aFatherLabel = theFather->GetLabel(), aLabel = theObject->GetLabel(); + DF_Label aFatherLabel = theFather.GetLabel(), aLabel = theObject.GetLabel(); if(aFatherLabel == aLabel) return false; - Handle(SALOMEDSImpl_AttributeTreeNode) aFather, aNode; + SALOMEDSImpl_AttributeTreeNode *aFather = false, *aNode = false; if(aFatherLabel.IsNull()) return false; - if(!aFatherLabel.FindAttribute(_root->ID(), aFather)) return false; + if(!(aFather=(SALOMEDSImpl_AttributeTreeNode*)aFatherLabel.FindAttribute(_root->ID()))) return false; if(aLabel.IsNull()) return false; - if(!aLabel.FindAttribute(_root->ID(), aNode)) { + if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) { aNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, _root->ID()); } @@ -187,18 +177,18 @@ bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const Handle(SALOMEDSImpl_SObject)& t * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const Handle(SALOMEDSImpl_SObject)& theFirst, - const Handle(SALOMEDSImpl_SObject)& theNext) +bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const SALOMEDSImpl_SObject& theFirst, + const SALOMEDSImpl_SObject& theNext) { - if(_root.IsNull() || theFirst.IsNull() || theNext.IsNull()) return false; + if(!_root || !theFirst || !theNext) return false; - TDF_Label aFirstLabel = theFirst->GetLabel(), aLabel= theNext->GetLabel(); + DF_Label aFirstLabel = theFirst.GetLabel(), aLabel= theNext.GetLabel(); if(aFirstLabel == aLabel) return false; - Handle(SALOMEDSImpl_AttributeTreeNode) aFirstNode, aNode; + SALOMEDSImpl_AttributeTreeNode *aFirstNode = NULL, *aNode = NULL; if(aFirstLabel.IsNull()) return false; - if(aFirstLabel.FindAttribute(_root->ID(), aFirstNode)) { + if((aFirstNode=(SALOMEDSImpl_AttributeTreeNode*)aFirstLabel.FindAttribute(_root->ID()))) { aFirstNode->Remove(); aFirstLabel.ForgetAttribute(aFirstNode->ID()); } @@ -206,7 +196,7 @@ bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const Handle(SALOMEDSImpl_SObject aFirstNode = SALOMEDSImpl_AttributeTreeNode::Set(aFirstLabel, _root->ID()); if(aLabel.IsNull()) return false; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return false; + if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false; aFirstNode->Remove(); @@ -219,18 +209,17 @@ bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const Handle(SALOMEDSImpl_SObject * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const SALOMEDSImpl_SObject& theObject) { - if(_root.IsNull() || theObject.IsNull()) return false; + if(!_root || !theObject) return false; - TDF_Label aLabel = theObject->GetLabel(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode; + DF_Label aLabel = theObject.GetLabel(); + SALOMEDSImpl_AttributeTreeNode* aNode = NULL; if(aLabel.IsNull()) return false; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return false; - + if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false; - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + SALOMEDSImpl_AttributeReference* aRef = NULL; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), aNode->Label()); } @@ -246,10 +235,10 @@ bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const Handle(SALOMEDSImpl_SOb //============================================================================ bool SALOMEDSImpl_UseCaseBuilder::SetRootCurrent() { - if(_root.IsNull()) return false; + if(!_root) return false; - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) + SALOMEDSImpl_AttributeReference* aRef = NULL; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label()); aRef->Set(_root->Label()); @@ -261,20 +250,20 @@ bool SALOMEDSImpl_UseCaseBuilder::SetRootCurrent() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const SALOMEDSImpl_SObject& theObject) { - if(_root.IsNull()) return false; + if(!_root) return false; - TDF_Label aLabel; - if (theObject.IsNull()) aLabel = _root->Label(); + DF_Label aLabel; + if (!theObject) aLabel = _root->Label(); else - aLabel = theObject->GetLabel(); + aLabel = theObject.GetLabel(); if(aLabel.IsNull()) return false; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode; - if(!aLabel.FindAttribute(_root->ID(), aNode)) return false; - - return !(aNode->GetFirst().IsNull()); + SALOMEDSImpl_AttributeTreeNode* aNode = NULL; + if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false; + + return (aNode->GetFirst()); } //============================================================================ @@ -282,15 +271,15 @@ bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const Handle(SALOMEDSImpl_SObject) * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::SetName(const TCollection_AsciiString& theName) { - if(_root.IsNull()) return false; +bool SALOMEDSImpl_UseCaseBuilder::SetName(const string& theName) { + if(!_root) return false; - Handle(SALOMEDSImpl_AttributeName) aNameAttrib; + SALOMEDSImpl_AttributeName* aNameAttrib = NULL; - if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttrib)) + if (!(aNameAttrib=(SALOMEDSImpl_AttributeName*)_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) aNameAttrib = SALOMEDSImpl_AttributeName::Set(_root->Label(), theName); - else - aNameAttrib->SetValue(theName); + + aNameAttrib->SetValue(theName); return true; } @@ -301,16 +290,18 @@ bool SALOMEDSImpl_UseCaseBuilder::SetName(const TCollection_AsciiString& theName * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetCurrentObject() +SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::GetCurrentObject() { - if(_root.IsNull()) return NULL; + SALOMEDSImpl_SObject so; + if(!_root) return so; - Handle(SALOMEDSImpl_AttributeReference) aRef; - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + SALOMEDSImpl_AttributeReference* aRef = NULL; + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label()); } - TDF_Label aCurrent = aRef->Get(); - if(aCurrent.IsNull()) return NULL; + + DF_Label aCurrent = aRef->Get(); + if(aCurrent.IsNull()) return so; return SALOMEDSImpl_Study::SObject(aCurrent); } @@ -320,15 +311,14 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetCurrentObject() * Purpose : */ //============================================================================ -TCollection_AsciiString SALOMEDSImpl_UseCaseBuilder::GetName() +string SALOMEDSImpl_UseCaseBuilder::GetName() { - TCollection_AsciiString aString; - if(_root.IsNull()) return aString; + string aString; + if(!_root) return aString; - Handle(SALOMEDSImpl_AttributeName) aName; - if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) return aString; - aString = TCollection_AsciiString(aName->Value()); - return aString; + SALOMEDSImpl_AttributeName* aName = NULL; + if (!(aName=(SALOMEDSImpl_AttributeName*)_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) return aString; + return aName->Value(); } //============================================================================ @@ -336,10 +326,10 @@ TCollection_AsciiString SALOMEDSImpl_UseCaseBuilder::GetName() * Purpose : */ //============================================================================ -bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const Handle(SALOMEDSImpl_SObject)& theObject) +bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const SALOMEDSImpl_SObject& theObject) { - if(theObject.IsNull()) return false; - TDF_Label aFather, aLabel = theObject->GetLabel(); + if(!theObject) return false; + DF_Label aFather, aLabel = theObject.GetLabel(); aFather = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); if(aLabel.Father() == aFather) return true; return false; @@ -350,33 +340,33 @@ bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const Handle(SALOMEDSImpl_SObject)& * Purpose : */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::AddUseCase(const TCollection_AsciiString& theName) +SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::AddUseCase(const string& theName) { - Standard_GUID aBasicGUID(USE_CASE_GUID); + string 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; + SALOMEDSImpl_AttributeTreeNode *aFatherNode = NULL, *aNode = NULL; + SALOMEDSImpl_AttributeInteger* anInteger = NULL; + SALOMEDSImpl_AttributeReference* aRef = NULL; - TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); + DF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); - if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) { + if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) { aRef = SALOMEDSImpl_AttributeReference::Set(aLabel, aLabel); } - if(!aRef->Get().FindAttribute(aBasicGUID, aFatherNode)) { + if(!(aFatherNode=(SALOMEDSImpl_AttributeTreeNode*)aRef->Get().FindAttribute(aBasicGUID))) { aFatherNode = SALOMEDSImpl_AttributeTreeNode::Set(aRef->Get(), aBasicGUID); } - if(!_root->FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anInteger)) { + if(!(anInteger=(SALOMEDSImpl_AttributeInteger*)_root->FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) { anInteger = SALOMEDSImpl_AttributeInteger::Set(aLabel, 0); - } + } //Create a new use case anInteger->SetValue(anInteger->Value()+1); - TDF_Label aChild = aLabel.FindChild(anInteger->Value()); + DF_Label aChild = aLabel.FindChild(anInteger->Value()); aNode = SALOMEDSImpl_AttributeTreeNode::Set(aChild, aBasicGUID); aNode->Remove(); aFatherNode->Append(aNode); @@ -390,25 +380,24 @@ Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::AddUseCase(const TColl * 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) +SALOMEDSImpl_UseCaseIterator +SALOMEDSImpl_UseCaseBuilder::GetUseCaseIterator(const SALOMEDSImpl_SObject& theObject) { - TDF_Label aLabel; + DF_Label aLabel; - if(!theObject.IsNull()) { - aLabel = theObject->GetLabel(); //Iterate only sub tree in the use case + if(theObject) { + 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); + return SALOMEDSImpl_UseCaseIterator(aLabel, USE_CASE_GUID, false); } -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetSObject(const TCollection_AsciiString& theEntry) +SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::GetSObject(const string& theEntry) { - TDF_Label aLabel; - TDF_Tool::Label(_doc->GetData(), theEntry, aLabel); - return SALOMEDSImpl_Study::SObject(aLabel); + DF_Label L = DF_Label::Label(_root->Label(), theEntry); + return SALOMEDSImpl_Study::SObject(L); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.hxx index ba4a55264..c54a5dd93 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.hxx @@ -24,63 +24,55 @@ #ifndef __SALOMEDSIMPL_USECaseBuilder_H__ #define __SALOMEDSIMPL_USECaseBuilder_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared ) - -// Cascade headers -#include -#include -#include -#include +#include +#include "DF_Document.hxx" +#include "DF_Label.hxx" +#include "SALOMEDSImpl_AttributeTreeNode.hxx" #include "SALOMEDSImpl_UseCaseIterator.hxx" -class SALOMEDSImpl_UseCaseBuilder : public MMgt_TShared +class SALOMEDSImpl_UseCaseBuilder { private: - Handle(SALOMEDSImpl_AttributeTreeNode) _root; - Handle(TDocStd_Document) _doc; + SALOMEDSImpl_AttributeTreeNode* _root; + DF_Document* _doc; public: //! standard constructor - Standard_EXPORT SALOMEDSImpl_UseCaseBuilder(const Handle(TDocStd_Document)& theDocument); + Standard_EXPORT SALOMEDSImpl_UseCaseBuilder(DF_Document* theDocument); //! standard destructor Standard_EXPORT ~SALOMEDSImpl_UseCaseBuilder(); - Standard_EXPORT virtual bool Append(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool Append(const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual bool Remove(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool Remove(const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual bool AppendTo(const Handle(SALOMEDSImpl_SObject)& theFather, const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool AppendTo(const SALOMEDSImpl_SObject& theFather, const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual bool InsertBefore(const Handle(SALOMEDSImpl_SObject)& theFirst, const Handle(SALOMEDSImpl_SObject)& theNext); + Standard_EXPORT virtual bool InsertBefore(const SALOMEDSImpl_SObject& theFirst, const SALOMEDSImpl_SObject& theNext); - Standard_EXPORT virtual bool SetCurrentObject(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool SetCurrentObject(const SALOMEDSImpl_SObject& theObject); Standard_EXPORT virtual bool SetRootCurrent(); - Standard_EXPORT virtual bool HasChildren(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool HasChildren(const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual bool IsUseCase(const Handle(SALOMEDSImpl_SObject)& theObject); + Standard_EXPORT virtual bool IsUseCase(const SALOMEDSImpl_SObject& theObject); - Standard_EXPORT virtual bool SetName(const TCollection_AsciiString& theName); + Standard_EXPORT virtual bool SetName(const std::string& theName); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetCurrentObject(); + Standard_EXPORT virtual SALOMEDSImpl_SObject GetCurrentObject(); - Standard_EXPORT virtual TCollection_AsciiString GetName(); + Standard_EXPORT virtual std::string GetName(); - Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) AddUseCase(const TCollection_AsciiString& theName); + Standard_EXPORT virtual SALOMEDSImpl_SObject AddUseCase(const std::string& theName); - Standard_EXPORT virtual Handle(SALOMEDSImpl_UseCaseIterator) GetUseCaseIterator(const Handle(SALOMEDSImpl_SObject)& anObject); + Standard_EXPORT virtual SALOMEDSImpl_UseCaseIterator GetUseCaseIterator(const SALOMEDSImpl_SObject& anObject); - Standard_EXPORT Handle(SALOMEDSImpl_SObject) GetSObject(const TCollection_AsciiString& theEntry); + Standard_EXPORT SALOMEDSImpl_SObject GetSObject(const std::string& theEntry); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_UseCaseBuilder ) }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.cxx index 24cc9e6e9..b6013a643 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.cxx @@ -27,20 +27,28 @@ using namespace std; -IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared ) -IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseIterator, MMgt_TShared ) +//============================================================================ +/*! Function : empty constructor + * Purpose : + */ +//============================================================================ +SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator() +{ + _node = NULL; +} + //============================================================================ /*! Function : constructor * Purpose : */ //============================================================================ -SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator(const TDF_Label& theLabel, - const Standard_GUID& theGUID, +SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator(const DF_Label& theLabel, + const string& theGUID, const bool allLevels) :_guid(theGUID), _levels(allLevels) { - if(theLabel.FindAttribute(_guid, _node)) { + if((_node = (SALOMEDSImpl_AttributeTreeNode*)theLabel.FindAttribute(_guid))) { _it.Initialize (_node, _levels); } } @@ -74,7 +82,7 @@ bool SALOMEDSImpl_UseCaseIterator::More() return _it.More(); } - //============================================================================ +//============================================================================ /*! Function : Next * */ @@ -91,9 +99,24 @@ void SALOMEDSImpl_UseCaseIterator::Next() */ //============================================================================ -Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseIterator::Value() +SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseIterator::Value() { - TDF_Label L = _it.Value()->Label(); + DF_Label L = _it.Value()->Label(); return SALOMEDSImpl_Study::SObject(L); } +//============================================================================ +/*! Function : GetPersistentCopy + * + */ +//============================================================================ +SALOMEDSImpl_UseCaseIterator* SALOMEDSImpl_UseCaseIterator::GetPersistentCopy() const +{ + SALOMEDSImpl_UseCaseIterator* itr = new SALOMEDSImpl_UseCaseIterator(); + itr->_it = _it; + itr->_node = _node; + itr->_guid = _guid; + itr->_levels = _levels; + + return itr; +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.hxx index d979ae263..a01cb1040 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseIterator.hxx @@ -24,32 +24,28 @@ #ifndef __SALOMEDSIMPL_USECASEITERATOR_H__ #define __SALOMEDSIMPL_USECASEITERATOR_H__ -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared ) - #include "SALOMEDSImpl_SObject.hxx" +#include "DF_ChildIterator.hxx" +#include "SALOMEDSImpl_ChildNodeIterator.hxx" -// Cascade headers -#include -#include -#include +#include -class SALOMEDSImpl_UseCaseIterator : public MMgt_TShared +class Standard_EXPORT SALOMEDSImpl_UseCaseIterator { private: - Standard_GUID _guid; + std::string _guid; bool _levels; - Handle(SALOMEDSImpl_AttributeTreeNode) _node; + SALOMEDSImpl_AttributeTreeNode* _node; SALOMEDSImpl_ChildNodeIterator _it; public: + SALOMEDSImpl_UseCaseIterator(); + //! standard constructor - SALOMEDSImpl_UseCaseIterator(const TDF_Label& theLabel, - const Standard_GUID& theGUID, + SALOMEDSImpl_UseCaseIterator(const DF_Label& theLabel, + const std::string& theGUID, const bool allLevels); //! standard destructor @@ -58,9 +54,8 @@ public: virtual void Init(bool); virtual bool More(); virtual void Next(); - virtual Handle(SALOMEDSImpl_SObject) Value(); + virtual SALOMEDSImpl_SObject Value(); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_UseCaseIterator ) + SALOMEDSImpl_UseCaseIterator* GetPersistentCopy() const; }; #endif diff --git a/src/SALOMEDSImpl/Test/Makefile.am b/src/SALOMEDSImpl/Test/Makefile.am index 014064ccd..e0c170eda 100644 --- a/src/SALOMEDSImpl/Test/Makefile.am +++ b/src/SALOMEDSImpl/Test/Makefile.am @@ -57,10 +57,10 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \ -I$(srcdir)/$(RPATH)/ResourcesManager \ -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ + -I$(srcdir)/$(RPATH)/DF \ -I$(srcdir)/$(RPATH)/SALOMEDSImpl \ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. @@ -77,6 +77,7 @@ COMMON_LIBS =\ $(RPATH)/SALOMELocalTrace/Test/libSALOMELocalTraceTest.la \ $(RPATH)/SALOMELocalTrace/libSALOMELocalTrace.la \ $(RPATH)/SALOMETraceCollector/Test/libSALOMETraceCollectorTest.la \ + $(RPATH)/DF/libDF.la \ $(RPATH)/SALOMEDSImpl/libSalomeDSImpl.la \ $(top_builddir)/idl/libSalomeIDLKernel.la diff --git a/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx b/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx index 30029799d..d1dff067a 100644 --- a/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx +++ b/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx @@ -33,8 +33,6 @@ #include "SALOMEDSImpl_StudyBuilder.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" -#include - using namespace std; // ============================================================================ @@ -45,11 +43,6 @@ using namespace std; void SALOMEDSImplTest::setUp() { - TCollection_AsciiString kernel(getenv("KERNEL_ROOT_DIR")); - TCollection_AsciiString subPath("/share/salome/resources/kernel"); - TCollection_AsciiString csf_var = (kernel+subPath); - setenv("CSF_PluginDefaults", csf_var.ToCString(), 0); - setenv("CSF_SALOMEDS_ResourcesDefaults", csf_var.ToCString(), 0); } // ============================================================================ @@ -70,11 +63,11 @@ SALOMEDSImplTest::tearDown() // ============================================================================ void SALOMEDSImplTest::testAttributeParameter() { - Handle(SALOMEDSImpl_StudyManager) sm = new SALOMEDSImpl_StudyManager(); - Handle(SALOMEDSImpl_Study) study = sm->NewStudy("Test"); - Handle(SALOMEDSImpl_AttributeParameter) _ap = study->GetCommonParameters("TestComp", 0); + SALOMEDSImpl_StudyManager* sm = new SALOMEDSImpl_StudyManager(); + SALOMEDSImpl_Study* study = sm->NewStudy("Test"); + SALOMEDSImpl_AttributeParameter* _ap = study->GetCommonParameters("TestComp", 0); - CPPUNIT_ASSERT(!_ap.IsNull()); + CPPUNIT_ASSERT(_ap); _ap->SetInt("IntValue", 1); CPPUNIT_ASSERT(_ap->IsSet("IntValue", PT_INTEGER)); diff --git a/src/SALOMEDSImpl/testDS.cxx b/src/SALOMEDSImpl/testDS.cxx index c256306e7..48a119b09 100644 --- a/src/SALOMEDSImpl/testDS.cxx +++ b/src/SALOMEDSImpl/testDS.cxx @@ -23,14 +23,12 @@ #include #include #include +#include -#include -#include -#include -#include -#include -#include -#include +#include "DF_Document.hxx" +#include "DF_Attribute.hxx" +#include "DF_Label.hxx" +#include "DF_ChildIterator.hxx" #include "SALOMEDSImpl_Attributes.hxx" #include "SALOMEDSImpl_StudyManager.hxx" @@ -39,77 +37,110 @@ #include "SALOMEDSImpl_SObject.hxx" #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_UseCaseBuilder.hxx" +#include "SALOMEDSImpl_UseCaseIterator.hxx" //#include "SALOMEDSImpl_.hxx" +using namespace std; + int main (int argc, char * argv[]) { cout << "Test started " << endl; - Handle(SALOMEDSImpl_StudyManager) aSM = new SALOMEDSImpl_StudyManager(); + SALOMEDSImpl_StudyManager* aSM = new SALOMEDSImpl_StudyManager(); cout << "Manager is created " << endl; - Handle(SALOMEDSImpl_Study) aStudy = aSM->NewStudy("SRN"); + SALOMEDSImpl_Study* aStudy = aSM->NewStudy("SRN"); cout << "Study with id = " << aStudy->StudyId() << " is created " << endl; cout << "Check the study lock, locking" << endl; aStudy->SetStudyLock("SRN"); cout << "Is study locked = " << aStudy->IsStudyLocked() << endl; - cout << "Get study locker : " << aStudy->GetLockerID() << endl; + vector ids = aStudy->GetLockerID(); + for(int i = 0; iUnLockStudy("SRN"); cout << "Is study locked = " << aStudy->IsStudyLocked() << endl; - Handle(SALOMEDSImpl_StudyBuilder) aBuilder = aStudy->NewBuilder(); + 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; + SALOMEDSImpl_SComponent aSC = aBuilder->NewComponent("TEST"); + cout << "New component with type " << aSC.ComponentDataType() << " is created " << endl; + SALOMEDSImpl_SObject aSO = aBuilder->NewObject(aSC); + cout << "New SObject with ID = " << aSO.GetID() << " is created" << endl; + cout << "An entry of newly created SO is " << aSO.GetLabel().Entry() << endl; + SALOMEDSImpl_AttributeIOR* aIORA = SALOMEDSImpl_AttributeIOR::Set(aSO.GetLabel(), "ior1234"); + cout << "New AttributeIOR is created, it contains " << dynamic_cast(aIORA)->Value() << endl; + cout << "Attribute has type: " << aIORA->Type() << " and value: " << aIORA->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); + cout << "Is SO null : " << aSO.IsNull()<< endl; + DF_Attribute* aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName"); + SALOMEDSImpl_AttributeName* aRN = dynamic_cast(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 << "Attribute has type: " << aRN->Type() << " and value: " << aRN->Save() << endl; cout << "Check GetObjectPath: " << aStudy->GetObjectPath(aSO) << endl; - Handle(SALOMEDSImpl_SObject) aSubSO = aBuilder->NewObject(aSO); + SALOMEDSImpl_SObject aSubSO = aBuilder->NewObject(aSO); aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeIOR"); - Handle(SALOMEDSImpl_AttributeIOR) aIOR2 = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(aTDFAttr); + SALOMEDSImpl_AttributeIOR* aIOR2 = dynamic_cast(aTDFAttr); aIOR2->SetValue("some ior"); aBuilder->Addreference(aSubSO, aSO); - Handle(SALOMEDSImpl_SObject) aRefObject; - aSubSO->ReferencedObject(aRefObject); - cout << "Check reference : ReferencedObject is " << aRefObject->GetID() << endl; + 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 << "Try invalid attribute creation" << endl; + aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "invalid type"); + cout << "Address of created attribute : " << aTDFAttr << endl; + + cout << "Check AttributeUserID" << endl; + + aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeUserID"); + if(aTDFAttr) { + cout << "Attribute UserID was created succesfully : id = " << dynamic_cast(aTDFAttr)->Value() << endl; + } + else cout << "Can't create AttributeUserID" << endl; + + string id = "0e1c36e6-379b-4d90-ab3b-17a14310e648"; + dynamic_cast(aTDFAttr)->SetValue(id); + cout << "SetValue id = " << dynamic_cast(aTDFAttr)->Value() << endl; + + string id2 = "0e1c36e6-379b-4d90-ab3b-18a14310e648"; + aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeUserID"+id2); + if(aTDFAttr) { + cout << "Attribute UserID was created succesfully : id = " << dynamic_cast(aTDFAttr)->Value() << endl; + } + else cout << "Can't create AttributeUserID" << endl; + cout << "Check AttributeTreeNode " << endl; aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeTreeNode"); - cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl; + cout << dynamic_cast(aTDFAttr)->Type() << endl; cout << "Check AttributeTreeNode : done " << endl; aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeParameter"); - cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl; + cout << dynamic_cast(aTDFAttr)->Type() << 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; + vector aSeq = aSO.GetAllAttributes(); + for(int i = 0; i < aSeq.size(); i++) + cout << "Found: " << dynamic_cast(aSeq[i])->Type() << endl; + cout << "Check UseCase" << endl; + SALOMEDSImpl_UseCaseBuilder* ucb = aStudy->GetUseCaseBuilder(); + ucb->AddUseCase("use_case1"); + ucb->AddUseCase("use_case2"); + SALOMEDSImpl_UseCaseIterator ucitr = ucb->GetUseCaseIterator(SALOMEDSImpl_SObject()); + ucitr.Init(false); + cout << "More? : " << ucitr.More() << endl; cout << "Check AttributeParameter " << endl; - Handle(SALOMEDSImpl_AttributeParameter) AP = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(aTDFAttr); + SALOMEDSImpl_AttributeParameter* AP = dynamic_cast(aTDFAttr); cout << "AttributeParameter with type : " << AP->Type() << endl; @@ -125,7 +156,7 @@ int main (int argc, char * argv[]) cout << "IsSet for string: " << AP->IsSet("1", PT_STRING) << " value : " << AP->GetString("1") << endl; /* for(int i = 2; i < 5; i++) { - TCollection_AsciiString s((double)(1.0/i)); + string s((double)(1.0/i)); cout << "Setting for " << i << " value : " << s << endl; AP->SetString(i, s); } @@ -162,7 +193,7 @@ int main (int argc, char * argv[]) vs.push_back("world!"); AP->SetStrArray("3", vs); - TCollection_AsciiString as = AP->Save(); + string as = AP->Save(); cout << "AS = " << as << endl; AP->Load(as); @@ -193,6 +224,23 @@ int main (int argc, char * argv[]) cout << "Check AttributeParameter : done" << endl; + + SALOMEDSImpl_SComponent tst = aBuilder->NewComponent("TEST2"); + aSO = aBuilder->NewObject(tst); + SALOMEDSImpl_SObject ss = aBuilder->NewObjectToTag(aSO, 3); + aBuilder->NewObjectToTag(ss, 1); + aBuilder->NewObjectToTag(ss, 3); + SALOMEDSImpl_SObject ss2 = aBuilder->NewObjectToTag(aSO, 2); + aBuilder->NewObjectToTag(ss, 2); + + SALOMEDSImpl_ChildIterator ci=aStudy->NewChildIterator(tst); + for(ci.InitEx(true); ci.More(); ci.Next()) + cout << "######## " << ci.Value().GetID() << endl; + + DF_ChildIterator dci(tst.GetLabel(), true); + for(; dci.More(); dci.Next()) + cout << "###### DF: " << dci.Value().Entry() << endl; + cout << "Test finished " << endl; return 0; } diff --git a/src/TOOLSDS/Makefile.am b/src/TOOLSDS/Makefile.am index e015ae928..a041e283f 100644 --- a/src/TOOLSDS/Makefile.am +++ b/src/TOOLSDS/Makefile.am @@ -40,15 +40,13 @@ COMMON_CPPFLAGS=\ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ @HDF5_INCLUDES@ \ @BOOST_CPPFLAGS@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ ../Utils/libOpUtil.la \ - $(top_builddir)/idl/libSalomeIDLKernel.la\ - @CAS_KERNEL@ + $(top_builddir)/idl/libSalomeIDLKernel.la # # =============================================================== diff --git a/src/TOOLSDS/SALOMEDS_Tool.cxx b/src/TOOLSDS/SALOMEDS_Tool.cxx index e67c96a5e..fcf2be69d 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.cxx +++ b/src/TOOLSDS/SALOMEDS_Tool.cxx @@ -28,24 +28,19 @@ #include "utilities.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include - #ifndef WNT -#include +#include +#include +#include #include #include -#include +#include +#include #else +#include +#include #endif + #include #include @@ -53,6 +48,22 @@ using namespace std; +bool Exists(const string thePath) +{ +#ifdef WNT + if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { + if ( GetLastError () != ERROR_FILE_NOT_FOUND ) { + return false; + } + } +#else + int status = access ( thePath.c_str() , F_OK ); + if (status != 0) return false; +#endif + return true; +} + + //============================================================================ // function : GetTempDir // purpose : Return a temp directory to store created files like "/tmp/sub_dir/" @@ -61,54 +72,57 @@ std::string SALOMEDS_Tool::GetTmpDir() { //Find a temporary directory to store a file - TCollection_AsciiString aTmpDir; + string aTmpDir = ""; char *Tmp_dir = getenv("SALOME_TMP_DIR"); if(Tmp_dir != NULL) { - aTmpDir = TCollection_AsciiString(Tmp_dir); + aTmpDir = string(Tmp_dir); #ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; + if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\'; #else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; + if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/'; #endif } else { #ifdef WIN32 - aTmpDir = TCollection_AsciiString("C:\\"); + aTmpDir = string("C:\\"); #else - aTmpDir = TCollection_AsciiString("/tmp/"); + aTmpDir = string("/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"); + char buffer[127]; + sprintf(buffer, "%d", aRND); + string aSubDir(buffer); + if(aSubDir.size() <= 1) aSubDir = string("123409876"); aTmpDir += aSubDir; //Get RND sub directory + string aDir = aTmpDir; + + if(Exists(aDir)) { + for(aRND = 0; Exists(aDir); aRND++) { + sprintf(buffer, "%d", aRND); + aDir = aTmpDir+buffer; //Build a unique directory name + } + } + #ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; + if(aDir[aDir.size()-1] != '\\') aDir+='\\'; #else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; + if(aDir[aTmpDir.size()-1] != '/') aDir+='/'; #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); - OSD_Protection aProtection(OSD_RWXD, OSD_RWX, OSD_RX, OSD_RX ); - aDir.Build(aProtection); +#ifdef WNT + CreateDirectory(aDir.c_str(), NULL); +#else + mkdir(aDir.c_str(), 0x1ff); +#endif - return aTmpDir.ToCString(); + return aDir; } //============================================================================ @@ -119,35 +133,29 @@ void SALOMEDS_Tool::RemoveTemporaryFiles(const std::string& theDirectory, const SALOMEDS::ListOfFileNames& theFiles, const bool IsDirDeleted) { - TCollection_AsciiString aDirName(const_cast(theDirectory.c_str())); + string aDirName = theDirectory; int i, aLength = theFiles.length(); - for(i=0; iMore()) - { - delete anIterator; - aDir.Remove(); - } + if(Exists(aDirName)) { +#ifdef WNT + RemoveDirectory(aDireName.c_str()); +#else + rmdir(aDirName.c_str()); +#endif + } } } @@ -169,7 +177,7 @@ namespace return (new SALOMEDS::TMPFile); //Get a temporary directory for saved a file - TCollection_AsciiString aTmpDir(const_cast(theFromDirectory.c_str())); + string aTmpDir = theFromDirectory; long aBufferSize = 0; long aCurrentPos; @@ -185,14 +193,12 @@ namespace //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 + const_cast(theFiles[i].in()); - OSD_Path anOSDPath(aFullPath); - OSD_File anOSDFile(anOSDPath); - if(!anOSDFile.Exists()) continue; + string aFullPath = aTmpDir + const_cast(theFiles[i].in()); + if(!Exists(aFullPath)) continue; #ifdef WNT - ifstream aFile(aFullPath.ToCString(), ios::binary); + ifstream aFile(aFullPath.c_str(), ios::binary); #else - ifstream aFile(aFullPath.ToCString()); + ifstream aFile(aFullPath.c_str()); #endif aFile.seekg(0, ios::end); aFileSize[i] = aFile.tellg(); @@ -221,14 +227,12 @@ namespace for(i=0; i(theFiles[i].in()); - OSD_Path anOSDPath(aFullPath); - OSD_File anOSDFile(anOSDPath); - if(!anOSDFile.Exists()) continue; + string aFullPath = aTmpDir + const_cast(theFiles[i].in()); + if(!Exists(aFullPath)) continue; #ifdef WNT - aFile = new ifstream(aFullPath.ToCString(), ios::binary); + aFile = new ifstream(aFullPath.c_str(), ios::binary); #else - aFile = new ifstream(aFullPath.ToCString()); + aFile = new ifstream(aFullPath.c_str()); #endif } //Initialize 4 bytes of the buffer by 0 @@ -300,7 +304,7 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, return aFiles; //Get a temporary directory for saving a file - TCollection_AsciiString aTmpDir(const_cast(theToDirectory.c_str())); + string aTmpDir = theToDirectory; unsigned char *aBuffer = (unsigned char*)theStream.NP_data(); @@ -331,11 +335,11 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, memcpy(&aFileSize, (aBuffer + aCurrentPos), ((sizeof(long) > 8) ? 8 : sizeof(long))); aCurrentPos += 8; - TCollection_AsciiString aFullPath = aTmpDir + aFileName; + string aFullPath = aTmpDir + aFileName; #ifdef WNT - ofstream aFile(aFullPath.ToCString(), ios::binary); + ofstream aFile(aFullPath.c_str(), ios::binary); #else - ofstream aFile(aFullPath.ToCString()); + ofstream aFile(aFullPath.c_str()); #endif aFile.write((char *)(aBuffer+aCurrentPos), aFileSize); aFile.close(); @@ -353,11 +357,30 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, // 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(thePath.c_str()))); - TCollection_AsciiString aNameString(aPath.Name()); - return aNameString.ToCString(); + if (thePath.empty()) return ""; + string aPath = thePath; + bool isFound = false; + int pos = aPath.rfind('/'); + if(pos > 0) { + aPath = aPath.substr(pos+1, aPath.size()); + isFound = true; + } + if(!isFound) { + pos = aPath.rfind('\\'); + if(pos > 0) { + aPath = aPath.substr(pos+1, aPath.size()); + isFound = true; + } + } + if(!isFound) { + pos = aPath.rfind('|'); + if(pos > 0) aPath = aPath.substr(pos+1, aPath.size()); + } + + pos = aPath.rfind('.'); + if(pos > 0) aPath = aPath.substr(0, pos); //Remove extension + + return aPath; } //============================================================================ @@ -365,12 +388,32 @@ std::string SALOMEDS_Tool::GetNameFromPath(const std::string& thePath) { // 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(thePath.c_str()))); - TCollection_AsciiString aDirString(aPath.Trek()); - aDirString.ChangeAll('|','/'); - return aDirString.ToCString(); + if (thePath.empty()) return ""; + + int pos = thePath.rfind('/'); + string path; + if(pos > 0) { + path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('\\'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + pos = thePath.rfind('|'); + if(pos > 0) path = thePath.substr(0, pos+1); + } + if(path.empty()) { + path = thePath+"/"; + } + +#ifdef WNT //Check if the only disk letter is given as path + if(path.size() == 2 && path[1] == ":") path +='\\'; +#endif + + for(int i = 0, len = path.size(); idestroy()" << std::endl; - _orb->destroy() ; + try { + _orb->destroy() ; + } + catch(...) { + MESSAGE("Caught CORBA::Exception."); + } //std::cerr << "retour _orb->destroy()" << std::endl; } } @@ -55,13 +60,9 @@ CORBA::ORB_var &ORB_INIT::operator() ( int argc , char **argv ) throw( CommExcep try { #if OMNIORB_VERSION >= 4 - const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } }; - _orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ; + _orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ; #else - _orb = CORBA::ORB_init( argc , argv ) ; - //set GIOP message size equal to 50Mb for transferring brep shapes as - //sequence of bytes using C++ streams - omniORB::MaxMessageSize(100*1024*1024); + _orb = CORBA::ORB_init( argc, argv, "omniORB3" ) ; #endif } catch( const CORBA::Exception &ex ) -- 2.39.2